nf-next: x_tables: Replace kmalloc(s*n) with kmalloc_array(n,s)
Subsystems (2)
PATCH 1/1 nf-next: x_tables: Replace kmalloc(s*n) with kmalloc_array(n,s)
It is easier to check that the calculation doesn't wrap or return a smaller allocation.
--- net/netfilter/x_tables.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/x_tables.c +1 -1
@@ -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 =kmalloc_array (num_hooks,sizeof (*ops),GFP_KERNEL );if (ops ==NULL )return ERR_PTR (-ENOMEM );
Signature · 1 line
2.9.2
Pablo Neira Ayuso
maintainerQuoted 2 lines · Loganaden Velvindron
It is easier to check that the calculation doesn't wrap or return a smaller allocation.
Could you review the netfilter tree in search for similar kmalloc() invocation that can be replaced? I could at least find one more at quick glace.
Thanks.
Quoted 9 lines · Pablo Neira Ayuso
Quoted 2 lines · Loganaden Velvindron
It is easier to check that the calculation doesn't wrap or return a smaller allocation.
Could you review the netfilter tree in search for similar
kmalloc()invocation that can be replaced? I could at least find one more at quick glace.Thanks.
Yes. I am currently working on that !
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 9 lines · Pablo Neira Ayuso
Quoted 2 lines · Loganaden Velvindron
It is easier to check that the calculation doesn't wrap or return a smaller allocation.
Could you review the netfilter tree in search for similar
kmalloc()invocation that can be replaced? I could at least find one more at quick glace.Thanks.
I saw quite a few, but many have constants. OK with replacing the ones with constants too ?
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html