From: Manish Ahuja Date: Mon, 9 Jul 2007 19:03:45 +0000 (+1000) Subject: [POWERPC] Fix loop with unsigned long counter variable X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=56d6d1a73d9e5ddd9eb1a7baeeda30803ba44879;p=linux-beck.git [POWERPC] Fix loop with unsigned long counter variable This fixes a possible infinite loop when the unsigned long counter "i" is used in lmb_add_region() in the following for loop: for (i = rgn->cnt-1; i >= 0; i--) by making the loop counter "i" be signed. Signed-off-by: Manish Ahuja Signed-off-by: Paul Mackerras --- diff --git a/arch/powerpc/mm/lmb.c b/arch/powerpc/mm/lmb.c index e3a1e8dc536a..8f4d2dc4cafb 100644 --- a/arch/powerpc/mm/lmb.c +++ b/arch/powerpc/mm/lmb.c @@ -138,8 +138,8 @@ void __init lmb_analyze(void) static long __init lmb_add_region(struct lmb_region *rgn, unsigned long base, unsigned long size) { - unsigned long i, coalesced = 0; - long adjacent; + unsigned long coalesced = 0; + long adjacent, i; /* First try and coalesce this LMB with another. */ for (i=0; i < rgn->cnt; i++) {