From: Tim Kientzle Date: Tue, 27 Mar 2012 09:43:25 +0000 (+0200) Subject: disk/part.c: Fix device enumeration through API X-Git-Tag: v2012.04-rc1~17^2^2~5 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=7e71dc68846647f387a74d50924da1218e197089;p=u-boot disk/part.c: Fix device enumeration through API The 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. Signed-off-by: Tim Kientzle Signed-off-by: Anatolij Gustschin --- diff --git a/disk/part.c b/disk/part.c index f07a17feb8..8ca5d4bdfc 100644 --- a/disk/part.c +++ b/disk/part.c @@ -80,6 +80,9 @@ block_dev_desc_t *get_dev(char* ifname, int dev) block_dev_desc_t* (*reloc_get_dev)(int dev); char *name; + if (!ifname) + return NULL; + name = drvr->name; #ifdef CONFIG_NEEDS_MANUAL_RELOC name += gd->reloc_off;