From: Wolfgang Denk Date: Fri, 23 Dec 2011 12:29:12 +0100 Subject: [U-Boot] [PATCH 3/3] post/lib_powerpc/multi.c: fix stack overflow error In-Reply-To: <1324639752-26856-1-git-send-email-wd@denx.de> References: <20111223002150.7e9d387d@wker> <1324639752-26856-1-git-send-email-wd@denx.de> Message-ID: <1324639752-26856-3-git-send-email-wd@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de The code and comment disagreed: the comment claimed that r6...r31 were copied, and consequently the arrays for "src" and "dst" were declared with 26 entries, but the actual code ("lmw r5,0(r3)" and "stmw r5,0(r4)") copied _27_ words (r5 through r31), which resulted in false "POST cpu Error at multi test" messages. Fix the comment and the array sizes. Signed-off-by: Wolfgang Denk Cc: Anatolij Gustschin Cc: Stefan Roese Cc: Kumar Gala Cc: Kim Phillips Cc: Andy Fleming --- post/lib_powerpc/multi.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/post/lib_powerpc/multi.c b/post/lib_powerpc/multi.c index b8619de..6642ee3 100644 --- a/post/lib_powerpc/multi.c +++ b/post/lib_powerpc/multi.c @@ -27,9 +27,9 @@ * CPU test * Load/store multiple word instructions: lmw, stmw * - * 26 consecutive words are loaded from a source memory buffer - * into GPRs r6 through r31. After that, 26 consecutive words are stored - * from the GPRs r6 through r31 into a target memory buffer. The contents + * 27 consecutive words are loaded from a source memory buffer + * into GPRs r5 through r31. After that, 27 consecutive words are stored + * from the GPRs r5 through r31 into a target memory buffer. The contents * of the source and target buffers are then compared. */ @@ -44,7 +44,7 @@ int cpu_post_test_multi(void) { int ret = 0; unsigned int i; - ulong src[26], dst[26]; + ulong src[27], dst[27]; int flag = disable_interrupts(); ulong code[] = { -- 1.7.6.4