diff options
author | YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> | 2007-04-20 18:57:15 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:29:12 -0400 |
commit | 334901700f9f58993ebd7f6136d3f9062460d34d (patch) | |
tree | af1887c408d6757debd73d2e56d45039943e413b /net/ipv4/proc.c | |
parent | 49ed67a9eee3c756263feed4474e4fcf5c8eaed2 (diff) |
[IPV4] SNMP: Move some statistic bits to net/ipv4/proc.c.
This also fixes memory leak in error path.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/proc.c')
-rw-r--r-- | net/ipv4/proc.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c index ae68a691e8cd..97952d54ae84 100644 --- a/net/ipv4/proc.c +++ b/net/ipv4/proc.c | |||
@@ -391,3 +391,28 @@ out_netstat: | |||
391 | goto out; | 391 | goto out; |
392 | } | 392 | } |
393 | 393 | ||
394 | int snmp_mib_init(void *ptr[2], size_t mibsize, size_t mibalign) | ||
395 | { | ||
396 | BUG_ON(ptr == NULL); | ||
397 | ptr[0] = __alloc_percpu(mibsize); | ||
398 | if (!ptr[0]) | ||
399 | goto err0; | ||
400 | ptr[1] = __alloc_percpu(mibsize); | ||
401 | if (!ptr[1]) | ||
402 | goto err1; | ||
403 | return 0; | ||
404 | err1: | ||
405 | free_percpu(ptr[0]); | ||
406 | ptr[0] = NULL; | ||
407 | err0: | ||
408 | return -ENOMEM; | ||
409 | } | ||
410 | |||
411 | void snmp_mib_free(void *ptr[2]) | ||
412 | { | ||
413 | BUG_ON(ptr == NULL); | ||
414 | free_percpu(ptr[0]); | ||
415 | free_percpu(ptr[1]); | ||
416 | ptr[0] = ptr[1] = NULL; | ||
417 | } | ||
418 | |||