netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] vlan: Remove unnecessary comparison of unsigned against 0
@ 2016-10-18  6:44 Tobias Klauser
  2016-10-18 14:25 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Tobias Klauser @ 2016-10-18  6:44 UTC (permalink / raw)
  To: Patrick McHardy, David S. Miller; +Cc: netdev

args.u.name_type is of type unsigned int and is always >= 0.

This fixes the following GCC warning:

  net/8021q/vlan.c: In function ‘vlan_ioctl_handler’:
  net/8021q/vlan.c:574:14: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
 net/8021q/vlan.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 8de138d3306b..f8903c1e1010 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -571,8 +571,7 @@ static int vlan_ioctl_handler(struct net *net, void __user *arg)
 		err = -EPERM;
 		if (!ns_capable(net->user_ns, CAP_NET_ADMIN))
 			break;
-		if ((args.u.name_type >= 0) &&
-		    (args.u.name_type < VLAN_NAME_TYPE_HIGHEST)) {
+		if (args.u.name_type < VLAN_NAME_TYPE_HIGHEST) {
 			struct vlan_net *vn;
 
 			vn = net_generic(net, vlan_net_id);
-- 
2.9.0

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

* Re: [PATCH] vlan: Remove unnecessary comparison of unsigned against 0
  2016-10-18  6:44 [PATCH] vlan: Remove unnecessary comparison of unsigned against 0 Tobias Klauser
@ 2016-10-18 14:25 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2016-10-18 14:25 UTC (permalink / raw)
  To: tklauser; +Cc: kaber, netdev

From: Tobias Klauser <tklauser@distanz.ch>
Date: Tue, 18 Oct 2016 08:44:17 +0200

> args.u.name_type is of type unsigned int and is always >= 0.
> 
> This fixes the following GCC warning:
> 
>   net/8021q/vlan.c: In function ‘vlan_ioctl_handler’:
>   net/8021q/vlan.c:574:14: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
> 
> Signed-off-by: Tobias Klauser <tklauser@distanz.ch>

Applied to net-next, thanks.

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

end of thread, other threads:[~2016-10-18 14:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-18  6:44 [PATCH] vlan: Remove unnecessary comparison of unsigned against 0 Tobias Klauser
2016-10-18 14:25 ` 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).