From patchwork Tue Feb 15 08:56:40 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lei Wen X-Patchwork-Id: 83218 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id D6161B70A4 for ; Tue, 15 Feb 2011 19:53:00 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id E048A28081; Tue, 15 Feb 2011 09:52:58 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VAEek9BQoSvD; Tue, 15 Feb 2011 09:52:58 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EEC0F28082; Tue, 15 Feb 2011 09:52:56 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1DAED28082 for ; Tue, 15 Feb 2011 09:52:55 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7f6oCrsToSTj for ; Tue, 15 Feb 2011 09:52:53 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from dakia2.marvell.com (dakia2.marvell.com [65.219.4.35]) by theia.denx.de (Postfix) with ESMTPS id 0528E28081 for ; Tue, 15 Feb 2011 09:52:51 +0100 (CET) X-ASG-Debug-ID: 1297759969-082c1ebc0001-4l7tJC Received: from maili.marvell.com (maili.marvell.com [10.68.76.51]) by dakia2.marvell.com with ESMTP id wwRtQEvdJjTomzma for ; Tue, 15 Feb 2011 00:52:49 -0800 (PST) X-Barracuda-Envelope-From: leiwen@marvell.com Received: from localhost (unknown [10.38.164.83]) by maili.marvell.com (Postfix) with ESMTP id C91908A43E for ; Tue, 15 Feb 2011 00:52:48 -0800 (PST) From: Lei Wen To: u-boot@lists.denx.de X-ASG-Orig-Subj: [PATCH] disk/part.c: fix potential stack overflow bug Date: Tue, 15 Feb 2011 16:56:40 +0800 X-ASG-Orig-Subj: [PATCH] disk/part.c: fix potential stack overflow bug Message-Id: <1297760200-15301-1-git-send-email-leiwen@marvell.com> X-Mailer: git-send-email 1.7.0.4 X-Barracuda-Connect: maili.marvell.com[10.68.76.51] X-Barracuda-Start-Time: 1297759968 X-Barracuda-URL: http://10.68.76.222:80/cgi-mod/mark.cgi X-Barracuda-Spam-Score: -1002.00 X-Barracuda-Spam-Status: No, SCORE=-1002.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=1000.0 Subject: [U-Boot] [PATCH] disk/part.c: fix potential stack overflow bug X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 --- disk/part.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) 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