linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Infinite loop/always true check possible with unsigned counter.
@ 2007-07-09 17:31 Manish Ahuja
  2007-07-09 19:03 ` Manish Ahuja
  0 siblings, 1 reply; 10+ messages in thread
From: Manish Ahuja @ 2007-07-09 17:31 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: ppc-dev

[-- Attachment #1: Type: text/plain, Size: 239 bytes --]

Fix to correct a possible infinite loop or an always true check 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--)

Signed-off-by: Manish Ahuja <ahuja@us.ibm.com>


[-- Attachment #2: unsigned --]
[-- Type: text/plain, Size: 698 bytes --]

---
 arch/powerpc/mm/lmb.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Index: 2.6.22-rc4/arch/powerpc/mm/lmb.c
===================================================================
--- 2.6.22-rc4.orig/arch/powerpc/mm/lmb.c	2007-06-11 21:10:46.000000000 -0500
+++ 2.6.22-rc4/arch/powerpc/mm/lmb.c	2007-07-06 21:47:40.000000000 -0500
@@ -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++) {

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2007-07-10 23:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-09 17:31 [PATCH] Infinite loop/always true check possible with unsigned counter Manish Ahuja
2007-07-09 19:03 ` Manish Ahuja
2007-07-10  0:19   ` Paul Mackerras
2007-07-10  0:41     ` Felix Domke
2007-07-10  9:46     ` Andreas Schwab
2007-07-10  9:49       ` Paul Mackerras
2007-07-10  9:55         ` Andreas Schwab
2007-07-10 10:08           ` Paul Mackerras
2007-07-10 18:39             ` Manish Ahuja
2007-07-10 23:19               ` Paul Mackerras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).