Patchwork [U-Boot] disk/part.c: fix potential stack overflow bug

login
register
mail settings
Submitter Lei Wen
Date Feb. 15, 2011, 8:56 a.m.
Message ID <1297760200-15301-1-git-send-email-leiwen@marvell.com>
Download mbox | patch
Permalink /patch/83218/
State Accepted
Commit b16aadf411280fc426d7488ddd8a5b2038b7194d
Headers show

Comments

Lei Wen - Feb. 15, 2011, 8:56 a.m.
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 |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Wolfgang Denk - April 12, 2011, 8:52 p.m.
Dear Lei Wen,

In message <1297760200-15301-1-git-send-email-leiwen@marvell.com> you wrote:
> 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 |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

Patch

diff --git a/disk/part.c b/disk/part.c
index 13723f2..f07a17f 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 (name) {
+	while (drvr->name) {
 		name = drvr->name;
 		reloc_get_dev = drvr->get_dev;
 #ifdef CONFIG_NEEDS_MANUAL_RELOC