[U-Boot] Patch: Fix device enumeration through API.
Tim Kientzle
kientzle at freebsd.org
Wed Feb 22 07:34:35 CET 2012
The one-line patch below fixes device enumeration through the
U-Boot API.
Device enumeration crashes when the system in question doesn't
have any RAM mapped to address zero (I discovered this on a
BeagleBone board), since the enumeration calls get_dev with a
NULL ifname sometimes which then gets passed down to strncmp().
This fix simply ensures that get_dev returns NULL when invoked
with a NULL ifname.
This could also be fixed by reworking the device enumeration to
never call get_dev with a NULL argument, but that's a much more
extensive change. (get_dev is called from several places and the
code is driven by a list that's constructed in a way that naturally
leaves lots of NULLs.)
Cheers,
Tim Kientzle
diff --git a/disk/part.c b/disk/part.c
index f07a17f..1a82539 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -84,7 +84,7 @@ block_dev_desc_t *get_dev(char* ifname, int dev)
#ifdef CONFIG_NEEDS_MANUAL_RELOC
name += gd->reloc_off;
#endif
- while (drvr->name) {
+ while (ifname && drvr->name) {
name = drvr->name;
reloc_get_dev = drvr->get_dev;
#ifdef CONFIG_NEEDS_MANUAL_RELOC
More information about the U-Boot
mailing list