[PATCH] Unsigned int type can't be below zero

Anton Lundin glance at acc.umu.se
Mon Jul 21 02:08:20 PDT 2014


This fixes a always false comparison that a unsigned int can never be
below zero. This was found when compiling with clang.

Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
 src/ihex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ihex.c b/src/ihex.c
index 69df787..46b4b81 100644
--- a/src/ihex.c
+++ b/src/ihex.c
@@ -142,7 +142,7 @@ dc_ihex_file_read (dc_ihex_file_t *file, dc_ihex_entry_t *entry)
 
 	/* Get the record type. */
 	type = data[3];
-	if (type < 0 || type > 5) {
+	if (type > 5) {
 		ERROR (file->context, "Invalid record type (0x%02x).", type);
 		return DC_STATUS_DATAFORMAT;
 	}
-- 
1.9.1



More information about the devel mailing list