ipvlan: Remove a useless comparison
authorYueHaibing <yuehaibing@huawei.com>
Mon, 10 Dec 2018 11:25:38 +0000 (19:25 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 10 Dec 2018 19:55:05 +0000 (11:55 -0800)
Fix following gcc warning:

drivers/net/ipvlan/ipvlan_main.c:543:12: warning:
 comparison is always false due to limited range of data type [-Wtype-limits]

'mode' is a u16 variable, IPVLAN_MODE_L2 is zero,
the comparison is always false

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ipvlan/ipvlan_main.c

index c3d3e458f541017e726cd7bf786cd34e5db41148..723a3f663c06a28b3c1441243bf9f62d16fd44c9 100644 (file)
@@ -540,7 +540,7 @@ static int ipvlan_nl_validate(struct nlattr *tb[], struct nlattr *data[],
        if (data[IFLA_IPVLAN_MODE]) {
                u16 mode = nla_get_u16(data[IFLA_IPVLAN_MODE]);
 
-               if (mode < IPVLAN_MODE_L2 || mode >= IPVLAN_MODE_MAX)
+               if (mode >= IPVLAN_MODE_MAX)
                        return -EINVAL;
        }
        if (data[IFLA_IPVLAN_FLAGS]) {