]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
disk/part.c: Fix device enumeration through API
authorTim Kientzle <kientzle@freebsd.org>
Tue, 27 Mar 2012 09:43:25 +0000 (11:43 +0200)
committerAnatolij Gustschin <agust@denx.de>
Tue, 27 Mar 2012 09:46:33 +0000 (11:46 +0200)
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 <kientzle@freebsd.org>
Signed-off-by: Anatolij Gustschin <agust@denx.de>
disk/part.c

index f07a17feb8a0e5e03663d986754e346779efe0ad..8ca5d4bdfc7a7203dede5d7b6bc6f8a226ca0b5a 100644 (file)
@@ -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;