From: Helmut Raiger Date: Mon, 22 Aug 2011 00:17:17 +0000 (+0000) Subject: net/eth.c: throw BUG for eth_get_dev_by_name(NULL) X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=7e7f903fcd7883d3646223e3cb30b50a7dfe6248;p=project%2Fbcm63xx%2Fu-boot.git net/eth.c: throw BUG for eth_get_dev_by_name(NULL) eth_get_dev_by_name() is not safe to use for devname being NULL as it uses strcmp. This patch makes it fail with a BUG(). Signed-off-by: Helmut Raiger Acked-by: Mike Frysinger --- diff --git a/net/eth.c b/net/eth.c index dbd1e2dbae..5911b1c786 100644 --- a/net/eth.c +++ b/net/eth.c @@ -108,6 +108,8 @@ struct eth_device *eth_get_dev_by_name(const char *devname) { struct eth_device *dev, *target_dev; + BUG_ON(devname == NULL); + if (!eth_devices) return NULL;