[U-Boot] [RFC PATCH] net: Check network device driver name
Michal Simek
monstr at monstr.eu
Fri Aug 26 14:52:40 CEST 2011
If name is longer than allocated space NAMESIZE
mac address is rewritten which show error
message like:
Error message:
Warning: Xlltemac.87000000 MAC addresses don't match:
Address in SROM is 30:00:00:00:00:00
Address in environment is 00:0a:35:00:6a:04
Signed-off-by: Michal Simek <monstr at monstr.eu>
---
net/eth.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/net/eth.c b/net/eth.c
index 3aad71f..54231b1 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -191,6 +191,13 @@ static void eth_current_changed(void)
int eth_register(struct eth_device *dev)
{
struct eth_device *d;
+
+ if (strlen(dev->name) > NAMESIZE) {
+ printf("Long(%d>%d) network driver name for %s\n",
+ strlen(dev->name), NAMESIZE, dev->name);
+ return 0;
+ }
+
if (!eth_devices) {
eth_current = eth_devices = dev;
eth_current_changed();
--
1.5.5.6
More information about the U-Boot
mailing list