Re: [PATCH] netfilter: initialize 'ret' variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Fri, Dec 02, 2022 at 03:03:31PM +0800, Li Qiong wrote:
>> The 'ret' should need to be initialized to 0, in case
>> return a uninitialized value.
> Why is 0 the right value?  And which case would it be?
> We clearly need to know that to figure out which return
> value would be correct for it...
Hi, 
here is a case:
for (i = 0; i < e->num_hook_entries; i++) {
    ret = e->hooks[i].hook(e->hooks[i].priv, skb, state);
    if (ret != NF_ACCEPT)
        return ret;
    ....
}
I am not sure if  0 (NF_DROP) is the best value, but It's better to  initialize  a value.




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux