aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorVeaceslav Falico <vfalico@redhat.com>2014-04-07 05:25:12 -0400
committerDavid S. Miller <davem@davemloft.net>2014-04-07 15:52:07 -0400
commit6859e7df6d9045a461412777e63bd8cef12f9705 (patch)
tree11e60459c57aa042d1d656ce3418614ca9de8863 /net
parent6f25cd47dcd2b9912c6e52aa833ba1614f7b5086 (diff)
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@redhat.com> CC: "David S. Miller" <davem@davemloft.net> CC: Eric Dumazet <edumazet@google.com> CC: Nicolas Dichtel <nicolas.dichtel@6wind.com> CC: Jiri Pirko <jiri@resnulli.us> CC: stephen hemminger <stephen@networkplumber.org> CC: Jerry Chu <hkchu@google.com> Signed-off-by: Veaceslav Falico <vfalico@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/dev.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 577701839f52..14dac0654f28 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,
4589 if (&lower->list == &dev->adj_list.lower) 4589 if (&lower->list == &dev->adj_list.lower)
4590 return NULL; 4590 return NULL;
4591 4591
4592 if (iter) 4592 *iter = lower->list.next;
4593 *iter = lower->list.next;
4594 4593
4595 return lower->private; 4594 return lower->private;
4596} 4595}
@@ -4618,8 +4617,7 @@ void *netdev_lower_get_next_private_rcu(struct net_device *dev,
4618 if (&lower->list == &dev->adj_list.lower) 4617 if (&lower->list == &dev->adj_list.lower)
4619 return NULL; 4618 return NULL;
4620 4619
4621 if (iter) 4620 *iter = &lower->list;
4622 *iter = &lower->list;
4623 4621
4624 return lower->private; 4622 return lower->private;
4625} 4623}