linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] ipvlan: Remove a useless comparison
@ 2018-12-10 11:25 YueHaibing
  2018-12-10 19:55 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2018-12-10 11:25 UTC (permalink / raw)
  To: davem, pabeni, idosch, ktkhai, lucien.xin, petrm
  Cc: linux-kernel, netdev, YueHaibing

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>
---
 drivers/net/ipvlan/ipvlan_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index 4a94956..162a337 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -535,7 +535,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]) {
-- 
2.7.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] ipvlan: Remove a useless comparison
  2018-12-10 11:25 [PATCH net-next] ipvlan: Remove a useless comparison YueHaibing
@ 2018-12-10 19:55 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-12-10 19:55 UTC (permalink / raw)
  To: yuehaibing
  Cc: pabeni, idosch, ktkhai, lucien.xin, petrm, linux-kernel, netdev

From: YueHaibing <yuehaibing@huawei.com>
Date: Mon, 10 Dec 2018 19:25:38 +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>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-12-10 19:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-10 11:25 [PATCH net-next] ipvlan: Remove a useless comparison YueHaibing
2018-12-10 19:55 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).