Re: ip_set_hash_netnet.c:62: possible typo ?

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

 



On Mon, 25 Nov 2013, David Binderman wrote:

> I just ran the static analyser "cppcheck" over the source
> code of linux-3.13-rc1. It said
> 
> [linux-3.13-rc1/net/netfilter/ipset/ip_set_hash_netnet.c:62] -> [linux-3.13-rc1/net/netfilter/ipset/ip_set_hash_netnet.c:62]: (style) Same expression on both sides of '=='.
> 
> Source code is
> 
> static inline bool
> hash_netnet4_data_equal(const struct hash_netnet4_elem *ip1,
>              const struct hash_netnet4_elem *ip2,
>              u32 *multi)
> {
>     return ip1->ipcmp == ip2->ipcmp &&
>            ip2->ccmp == ip2->ccmp;
> }
> 
> Maybe 
> 
> static inline bool
> hash_netnet4_data_equal(const struct hash_netnet4_elem *ip1,
>              const struct hash_netnet4_elem *ip2,
>              u32 *multi)
> {
>     return ip1->ipcmp == ip2->ipcmp &&
>            ip1->ccmp == ip2->ccmp;
> }
> 
> would be better code ?

Yes, you are completely right. I'm going to check why the testsuite did 
not catch it.

Best regards,
Jozsef
-
E-mail  : kadlec@xxxxxxxxxxxxxxxxx, kadlecsik.jozsef@xxxxxxxxxxxxx
PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences
          H-1525 Budapest 114, POB. 49, Hungary

[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux