Re: [PATCH] netfilter: fix possible ZERO_SIZE_PTR pointer dereferencing error.

2016-06-01 Thread Pablo Neira Ayuso
On Wed, Jun 01, 2016 at 04:34:28PM +0800, Xiubo Li wrote: > Since we cannot make sure the 'hook_mask' will always be none zero > here. If it equals to zero, the num_hooks will be zero too, and then > kmalloc() will return ZERO_SIZE_PTR, which is (void *)16. > > Then the following error check will

[PATCH] netfilter: fix possible ZERO_SIZE_PTR pointer dereferencing error.

2016-06-01 Thread Xiubo Li
Since we cannot make sure the 'hook_mask' will always be none zero here. If it equals to zero, the num_hooks will be zero too, and then kmalloc() will return ZERO_SIZE_PTR, which is (void *)16. Then the following error check will fails: ops = kmalloc(sizeof(*ops) * num_hooks, GFP_KERNEL); if