aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorMiaohe Lin <linmiaohe@huawei.com>2020-08-25 08:10:37 -0400
committerDavid S. Miller <davem@davemloft.net>2020-08-25 06:23:59 -0700
commitfdf1923bf9f7d4d5574187722a247707344eded9 (patch)
tree21743c6cfead575fe940e1f8c77c1dd362e9f25a /net/ipv4
parentnet: Avoid unnecessary inet_addr_type() call when addr is INADDR_ANY (diff)
downloadlinux-dev-fdf1923bf9f7d4d5574187722a247707344eded9.tar.xz
linux-dev-fdf1923bf9f7d4d5574187722a247707344eded9.zip
net: Remove duplicated midx check against 0
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/ip_sockglue.c5
1 files 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;