From 7e7f903fcd7883d3646223e3cb30b50a7dfe6248 Mon Sep 17 00:00:00 2001 From: Helmut Raiger Date: Mon, 22 Aug 2011 00:17:17 +0000 Subject: [PATCH] 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 --- net/eth.c | 2 ++ 1 file changed, 2 insertions(+) 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; -- 2.25.1