Skip to content

Commit

Permalink
[POWERPC] Fix loop with unsigned long counter variable
Browse files Browse the repository at this point in the history
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 <ahuja@austin.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Manish Ahuja authored and Paul Mackerras committed Jul 26, 2007
1 parent 7792682 commit 56d6d1a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/powerpc/mm/lmb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit 56d6d1a

Please sign in to comment.