Skip to contentSkip to conversation

mfd: off by one calculating size

PATCH In review Dan Carpenter 3 participants 3 messages Mar 22, 2010 – Mar 25, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: off by one calculating size

I'm pretty sure that it should be + 1 here. It's an off by one, because we start counting at zero.

---
Found by a static checker and untested. Please review carefully.

drivers/mfd/timberdale.h +1 -1
index 8d27ffa..902c451 100644
@@ -66,7 +66,7 @@
 
 #define CHIPCTLOFFSET	0x800
 #define CHIPCTLEND	0x8ff
-#define CHIPCTLSIZE	(CHIPCTLEND - CHIPCTLOFFSET)
+#define CHIPCTLSIZE	(CHIPCTLEND - CHIPCTLOFFSET + 1)
 
 #define INTCOFFSET	0xc00
 #define INTCEND		0xfff
Acked-by on v1 1/1
#1 lore raw
Quoted 2 lines · Dan Carpenter

I'm pretty sure that it should be + 1 here. It's an off by one, because we start counting at zero.

You are completely right, fortunately we don't access the last register.

Quoted 1 line
Quoted 8 lines

---
Found by a static checker and untested. Please review carefully.

drivers/mfd/timberdale.h +0 -0
index 8d27ffa..902c451 100644

drivers/mfd/timberdale.h line 72

Quoted 8 lines
drivers/mfd/timberdale.h +1 -1
@@ -66,7 +66,7 @@
 
  #define CHIPCTLOFFSET	0x800
  #define CHIPCTLEND	0x8ff
-#define CHIPCTLSIZE	(CHIPCTLEND - CHIPCTLOFFSET)
+#define CHIPCTLSIZE	(CHIPCTLEND - CHIPCTLOFFSET + 1)
 
  #define INTCOFFSET	0xc00
  #define INTCEND		0xfff

--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to Dan Carpenter

Hi Dan,

Quoted 2 lines · Dan Carpenter

I'm pretty sure that it should be + 1 here. It's an off by one, because we start counting at zero.

Thanks Dan, patch applied to my for-next branch.

Cheers,
Samuel.

Quoted 17 lines

---
Found by a static checker and untested. Please review carefully.

drivers/mfd/timberdale.h +1 -1
index 8d27ffa..902c451 100644
@@ -66,7 +66,7 @@
 
 #define CHIPCTLOFFSET	0x800
 #define CHIPCTLEND	0x8ff
-#define CHIPCTLSIZE	(CHIPCTLEND - CHIPCTLOFFSET)
+#define CHIPCTLSIZE	(CHIPCTLEND - CHIPCTLOFFSET + 1)
 
 #define INTCOFFSET	0xc00
 #define INTCEND		0xfff
Signature · 2 lines
Intel Open Source Technology Centre
http://oss.intel.com/