[U-Boot] [PATCH 1/2] net/eth.c: make eth_get_dev_by_name(NULL) safe
helmut.raiger at hale.at
helmut.raiger at hale.at
Mon Jul 4 12:29:51 CEST 2011
From: Helmut Raiger <helmut.raiger at hale.at>
eth_get_dev_by_name() is not safe to use for devname being NULL
as it uses strcmp. This patch makes it return NULL if devname NULL
is passed.
Signed-off-by: Helmut Raiger <helmut.raiger at hale.at>
---
net/eth.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/eth.c b/net/eth.c
index 6523834..c75b7c9 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -107,7 +107,7 @@ struct eth_device *eth_get_dev_by_name(const char *devname)
{
struct eth_device *dev, *target_dev;
- if (!eth_devices)
+ if (!eth_devices || !devname)
return NULL;
dev = eth_devices;
--
1.7.4.4
--
Scanned by MailScanner.
More information about the U-Boot
mailing list