* [PATCH] net: Remove duplicated midx check against 0
@ 2020-08-25 12:10 Miaohe Lin
2020-08-25 13:24 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Miaohe Lin @ 2020-08-25 12:10 UTC (permalink / raw)
To: davem, kuznet, yoshfuji, kuba; +Cc: netdev, linux-kernel, linmiaohe
Check midx against 0 is always equal to check midx against sk_bound_dev_if
when sk_bound_dev_if is known not equal to 0 in these case.
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
net/ipv4/ip_sockglue.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index d2c223554ff7..ec6036713e2c 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -1124,8 +1124,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, int optname,
dev_put(dev);
err = -EINVAL;
- if (sk->sk_bound_dev_if &&
- (!midx || midx != sk->sk_bound_dev_if))
+ if (sk->sk_bound_dev_if && midx != sk->sk_bound_dev_if)
break;
inet->uc_index = ifindex;
@@ -1189,7 +1188,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, int optname,
err = -EINVAL;
if (sk->sk_bound_dev_if &&
mreq.imr_ifindex != sk->sk_bound_dev_if &&
- (!midx || midx != sk->sk_bound_dev_if))
+ midx != sk->sk_bound_dev_if)
break;
inet->mc_index = mreq.imr_ifindex;
--
2.19.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net: Remove duplicated midx check against 0
2020-08-25 12:10 [PATCH] net: Remove duplicated midx check against 0 Miaohe Lin
@ 2020-08-25 13:24 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-08-25 13:24 UTC (permalink / raw)
To: linmiaohe; +Cc: kuznet, yoshfuji, kuba, netdev, linux-kernel
From: Miaohe Lin <linmiaohe@huawei.com>
Date: Tue, 25 Aug 2020 08:10:37 -0400
> Check midx against 0 is always equal to check midx against sk_bound_dev_if
> when sk_bound_dev_if is known not equal to 0 in these case.
>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Applied to net-next, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-08-25 13:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-25 12:10 [PATCH] net: Remove duplicated midx check against 0 Miaohe Lin
2020-08-25 13:24 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.