disk/part.c: fix potential stack overflow bug
authorLei Wen <leiwen@marvell.com>
Tue, 15 Feb 2011 08:56:40 +0000 (16:56 +0800)
committerWolfgang Denk <wd@denx.de>
Tue, 12 Apr 2011 20:58:35 +0000 (22:58 +0200)
If the param pass to get_dev is not the one defined in the block_drvr,
it could make uboot becomes unstable, for it would continue run after
search complete the block_drvr table.

Signed-off-by: Lei Wen <leiwen@marvell.com>
disk/part.c

index 13723f23b3113c74fa7b2590de65bf0d7d3c5a6b..f07a17feb8a0e5e03663d986754e346779efe0ad 100644 (file)
@@ -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 (name) {
+       while (drvr->name) {
                name = drvr->name;
                reloc_get_dev = drvr->get_dev;
 #ifdef CONFIG_NEEDS_MANUAL_RELOC