All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] maps: test before subtraction on unsigned long intel1size
@ 2009-03-05 12:11 Roel Kluin
  0 siblings, 0 replies; only message in thread
From: Roel Kluin @ 2009-03-05 12:11 UTC (permalink / raw)
  To: dwmw2; +Cc: Andrew Morton, linux-mtd@lists.infradead.org

I found this by code inspection, I could be wrong, but isn't a test required
before this subtraction? note that intel1size is unsigned long.
Also I noted that the file makes extensive use of volatile. is that necessary?
------------------------------>8-------------8<---------------------------------
Test before subtraction on unsigned long intel1size.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/drivers/mtd/maps/nettel.c b/drivers/mtd/maps/nettel.c
index a97133e..ed2fc83 100644
--- a/drivers/mtd/maps/nettel.c
+++ b/drivers/mtd/maps/nettel.c
@@ -349,11 +349,12 @@ static int __init nettel_init(void)
 		goto out_unmap1;
 	}
 
-	intel1size = intel_mtd->size - intel0size;
-	if (intel1size > 0) {
+	if (intel_mtd->size > intel0size) {
+		intel1size = intel_mtd->size - intel0size;
 		*intel1par = SC520_PAR(intel1cs, intel1addr, intel1size);
 		__asm__ ("wbinvd");
 	} else {
+		intel1size = 0;
 		*intel1par = 0;
 	}
 

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-05 12:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-05 12:11 [PATCH] maps: test before subtraction on unsigned long intel1size Roel Kluin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.