gen_stats.c: Duplicate xstats buffer for later use
authorIgnacy Gawędzki <ignacy.gawedzki@green-communications.fr>
Fri, 13 Feb 2015 22:47:05 +0000 (14:47 -0800)
committerBen Hutchings <ben@decadent.org.uk>
Sat, 9 May 2015 22:16:37 +0000 (23:16 +0100)
commit24aa85b0d9ef3f2cd3d99be59bbf58fba269ba08
tree6b77a3142bc46cf68b870011cebc8a4000859a81
parentc9f412a4c739cb7eb2b6af845f97539d8d1fcf44
gen_stats.c: Duplicate xstats buffer for later use

[ Upstream commit 1c4cff0cf55011792125b6041bc4e9713e46240f ]

The gnet_stats_copy_app() function gets called, more often than not, with its
second argument a pointer to an automatic variable in the caller's stack.
Therefore, to avoid copying garbage afterwards when calling
gnet_stats_finish_copy(), this data is better copied to a dynamically allocated
memory that gets freed after use.

[xiyou.wangcong@gmail.com: remove a useless kfree()]

Signed-off-by: Ignacy Gawędzki <ignacy.gawedzki@green-communications.fr>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
net/core/gen_stats.c