[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1396862712-5225-1-git-send-email-vfalico@redhat.com>
Date: Mon, 7 Apr 2014 11:25:12 +0200
From: Veaceslav Falico <vfalico@...hat.com>
To: netdev@...r.kernel.org
Cc: dborkman@...hat.com, Veaceslav Falico <vfalico@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Nicolas Dichtel <nicolas.dichtel@...nd.com>,
Jiri Pirko <jiri@...nulli.us>,
stephen hemminger <stephen@...workplumber.org>,
Jerry Chu <hkchu@...gle.com>
Subject: [PATCH net] netdev: remove potentially harmful checks
Currently we're checking a variable for != NULL after actually
dereferencing it, in netdev_lower_get_next_private*().
It's counter-intuitive at best, and can lead to faulty usage (as it implies
that the variable can be NULL), so fix it by removing the useless checks.
Reported-by: Daniel Borkmann <dborkman@...hat.com>
CC: "David S. Miller" <davem@...emloft.net>
CC: Eric Dumazet <edumazet@...gle.com>
CC: Nicolas Dichtel <nicolas.dichtel@...nd.com>
CC: Jiri Pirko <jiri@...nulli.us>
CC: stephen hemminger <stephen@...workplumber.org>
CC: Jerry Chu <hkchu@...gle.com>
Signed-off-by: Veaceslav Falico <vfalico@...hat.com>
---
net/core/dev.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 5777018..14dac06 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4589,8 +4589,7 @@ void *netdev_lower_get_next_private(struct net_device *dev,
if (&lower->list == &dev->adj_list.lower)
return NULL;
- if (iter)
- *iter = lower->list.next;
+ *iter = lower->list.next;
return lower->private;
}
@@ -4618,8 +4617,7 @@ void *netdev_lower_get_next_private_rcu(struct net_device *dev,
if (&lower->list == &dev->adj_list.lower)
return NULL;
- if (iter)
- *iter = &lower->list;
+ *iter = &lower->list;
return lower->private;
}
--
1.8.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists