lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 22 Nov 2021 01:16:53 -0800
From:   Joe Perches <joe@...ches.com>
To:     Yajun Deng <yajun.deng@...ux.dev>, davem@...emloft.net,
        kuba@...nel.org
Cc:     netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next] neighbor: Remove redundant if statement

On Mon, 2021-11-22 at 16:49 +0800, Yajun Deng wrote:
> The if statement already exists in the __neigh_event_send() function,
> remove redundant if statement.
[]
> diff --git a/include/net/neighbour.h b/include/net/neighbour.h
[]
> @@ -452,9 +452,7 @@ static inline int neigh_event_send(struct neighbour *neigh, struct sk_buff *skb)
>  	
>  	if (READ_ONCE(neigh->used) != now)
>  		WRITE_ONCE(neigh->used, now);
> -	if (!(neigh->nud_state&(NUD_CONNECTED|NUD_DELAY|NUD_PROBE)))
> -		return __neigh_event_send(neigh, skb);
> -	return 0;
> +	return __neigh_event_send(neigh, skb);
>  }

Perhaps this is an optimization to avoid the lock/unlock in __neigh_event_send?
If so a comment could be useful.

And also perhaps this code would be clearer with the test reversed:

	if (neigh->nud_state & (NUD_CONNECTED | NUD_DELAY | NUD_PROBE))
		return 0;

	return __neigh_event_send(neigh, skb);


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ