From: Veaceslav Falico Date: Mon, 7 Apr 2014 09:25:12 +0000 (+0200) Subject: netdev: remove potentially harmful checks X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6859e7df6d9045a461412777e63bd8cef12f9705;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 CC: "David S. Miller" CC: Eric Dumazet CC: Nicolas Dichtel CC: Jiri Pirko CC: stephen hemminger CC: Jerry Chu Signed-off-by: Veaceslav Falico Signed-off-by: David S. Miller --- 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, 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; }