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>
This commit is contained in:
Miaohe Lin 2020-08-25 08:10:37 -04:00 committed by David S. Miller
parent 0ce779a9f5
commit fdf1923bf9
1 changed files with 2 additions and 3 deletions

View File

@ -1124,8 +1124,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, int optname,
dev_put(dev); dev_put(dev);
err = -EINVAL; err = -EINVAL;
if (sk->sk_bound_dev_if && if (sk->sk_bound_dev_if && midx != sk->sk_bound_dev_if)
(!midx || midx != sk->sk_bound_dev_if))
break; break;
inet->uc_index = ifindex; inet->uc_index = ifindex;
@ -1189,7 +1188,7 @@ static int do_ip_setsockopt(struct sock *sk, int level, int optname,
err = -EINVAL; err = -EINVAL;
if (sk->sk_bound_dev_if && if (sk->sk_bound_dev_if &&
mreq.imr_ifindex != 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; break;
inet->mc_index = mreq.imr_ifindex; inet->mc_index = mreq.imr_ifindex;