]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: SNMP NAT: correct the size argument to kzalloc
authorJulia Lawall <julia@diku.dk>
Mon, 4 Jan 2010 14:21:31 +0000 (15:21 +0100)
committerPatrick McHardy <kaber@trash.net>
Mon, 4 Jan 2010 14:21:31 +0000 (15:21 +0100)
commitc2525c0b19b00692c9f1b5bb998e6d833cb86d86
tree06363bb4142abdf0c308b60198d23f2849a7355d
parent56dd76367f1cd967ad87e5c3a428212490c62476
netfilter: SNMP NAT: correct the size argument to kzalloc

obj has type struct snmp_object **, not struct snmp_object *.  But indeed
it is not even clear why kmalloc is needed.  The memory is freed by the end
of the function, so the local variable of pointer type should be sufficient.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@disable sizeof_type_expr@
type T;
T **x;
@@

  x =
  <+...sizeof(
- T
+ *x
  )...+>
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Patrick McHardy <kaber@trash.net>
net/ipv4/netfilter/nf_nat_snmp_basic.c