Skip to contentSkip to conversation

km/ivm: fix string len check to support 7 char board names

PATCH New Holger Brunck 1 participant 2 messages Aug 9, 2012 – Aug 14, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 km/ivm: fix string len check to support 7 char board names

From: Valentin Longchamp <[email protected]>

The fanless boards now have a 7-digit (XXXXX-F) board name. This triggers a border condition when reading this string in the IVM although this string is smaller than the currenly read string size, but only by 1 character.

This patch corrects this by changing the size check condition for string length.

---
 board/keymile/common/ivm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
board/keymile/common/ivm.c +1 -1
index 9bc3c21..eaa924f 100644
@@ -163,7 +163,7 @@ static int ivm_findinventorystring(int type,
 		if (addr == INVENTORYDATASIZE) {
 			xcode = -1;
 			printf("Error end of string not found\n");
-		} else if ((size >= (maxlen - 1)) &&
+		} else if ((size > (maxlen - 1)) &&
 			   (buf[addr] != '\r')) {
 			xcode = -1;
 			printf("string too long till next CR\n");
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 km/ivm: fix string len check to support 7 char board names

Hi Wolfgang,

Quoted 7 lines · Holger Brunck

From: Valentin Longchamp <[email protected]>

The fanless boards now have a 7-digit (XXXXX-F) board name. This triggers a border condition when reading this string in the IVM although this string is smaller than the currenly read string size, but only by 1 character.

Quoted 9 lines

This patch corrects this by changing the size check condition for string length.

---
 board/keymile/common/ivm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

could you please drop this patch? It was posted twice by accident and the other (same) patch is running through Prafullas branch.

http://patchwork.ozlabs.org/patch/177225/

Sorry for this.

Regards
Holger Brunck