Re: [PATCH nf] netfilter: x_tables: suppress kmemcheck warning

2016-10-19 Thread Pablo Neira Ayuso
On Mon, Oct 17, 2016 at 09:50:23PM +0200, Florian Westphal wrote:
> Markus Trippelsdorf reports:
> 
> WARNING: kmemcheck: Caught 64-bit read from uninitialized memory 
> (88001e605480)
> 4055601e008890686d81
>  u u u u u u u u u u u u u u u u i i i i i i i i u u u u u u u u
>  ^
> |RIP: 0010:[]  [] 
> nf_register_net_hook+0x51/0x160
> [..]
>  [] nf_register_net_hook+0x51/0x160
>  [] nf_register_net_hooks+0x3f/0xa0
>  [] ipt_register_table+0xe5/0x110
> [..]
> 
> This warning is harmless; we copy 'uninitialized' data from the hook ops
> but it will not be used.
> Long term the structures keeping run-time data should be disentangled
> from those only containing config-time data (such as where in the list
> to insert a hook), but thats -next material.

Applied, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH nf] netfilter: x_tables: suppress kmemcheck warning

2016-10-17 Thread Florian Westphal
Markus Trippelsdorf reports:

WARNING: kmemcheck: Caught 64-bit read from uninitialized memory 
(88001e605480)
4055601e008890686d81
 u u u u u u u u u u u u u u u u i i i i i i i i u u u u u u u u
 ^
|RIP: 0010:[]  [] 
nf_register_net_hook+0x51/0x160
[..]
 [] nf_register_net_hook+0x51/0x160
 [] nf_register_net_hooks+0x3f/0xa0
 [] ipt_register_table+0xe5/0x110
[..]

This warning is harmless; we copy 'uninitialized' data from the hook ops
but it will not be used.
Long term the structures keeping run-time data should be disentangled
from those only containing config-time data (such as where in the list
to insert a hook), but thats -next material.

Reported-by: Markus Trippelsdorf 
Suggested-by: Al Viro 
Signed-off-by: Florian Westphal 
---
 net/netfilter/x_tables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c
index e0aa7c1d0224..fc4977456c30 100644
--- a/net/netfilter/x_tables.c
+++ b/net/netfilter/x_tables.c
@@ -1513,7 +1513,7 @@ xt_hook_ops_alloc(const struct xt_table *table, nf_hookfn 
*fn)
if (!num_hooks)
return ERR_PTR(-EINVAL);
 
-   ops = kmalloc(sizeof(*ops) * num_hooks, GFP_KERNEL);
+   ops = kcalloc(num_hooks, sizeof(*ops), GFP_KERNEL);
if (ops == NULL)
return ERR_PTR(-ENOMEM);
 
-- 
2.7.3

--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html