net/eth.c: throw BUG for eth_get_dev_by_name(NULL)
authorHelmut Raiger <helmut.raiger@hale.at>
Mon, 22 Aug 2011 00:17:17 +0000 (00:17 +0000)
committerWolfgang Denk <wd@denx.de>
Fri, 9 Sep 2011 21:58:47 +0000 (23:58 +0200)
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 <helmut.raiger@hale.at>
Acked-by: Mike Frysinger <vapier@gentoo.org>
net/eth.c

index dbd1e2dbae6dc264455ee3683abce39f78ec9e58..5911b1c78609578dca32525ad29431795721b7f8 100644 (file)
--- 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;