[U-Boot] [PATCH] km/ivm: fix string len check to support 7 char board names

Holger Brunck holger.brunck at keymile.com
Thu Aug 9 13:43:03 CEST 2012


From: Valentin Longchamp <valentin.longchamp at keymile.com>

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.

Signed-off-by: Valentin Longchamp <valentin.longchamp at keymile.com>
cc: Wolfgang Denk <wd at denx.de>
---
 board/keymile/common/ivm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c
index 9bc3c21..eaa924f 100644
--- a/board/keymile/common/ivm.c
+++ b/board/keymile/common/ivm.c
@@ -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");
-- 
1.7.1



More information about the U-Boot mailing list