]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: Remove duplicated midx check against 0
authorMiaohe Lin <linmiaohe@huawei.com>
Tue, 25 Aug 2020 12:10:37 +0000 (08:10 -0400)
committerDavid S. Miller <davem@davemloft.net>
Tue, 25 Aug 2020 13:23:59 +0000 (06:23 -0700)
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>
net/ipv4/ip_sockglue.c

index d2c223554ff7054d341265a4c87187543e011698..ec6036713e2c256261002f8ec82a9f5e749782d3 100644 (file)
@@ -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;