[coreboot-gerrit] New patch to review for coreboot: de590c4 util/fletcher: fix debug option parsing

Patrick Georgi (patrick@georgi-clan.de) gerrit at coreboot.org
Mon Sep 29 10:14:08 CEST 2014


Patrick Georgi (patrick at georgi-clan.de) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6988

-gerrit

commit de590c42869e07911dc06a5e401c90273493df05
Author: Patrick Georgi <patrick at georgi-clan.de>
Date:   Mon Sep 29 10:12:29 2014 +0200

    util/fletcher: fix debug option parsing
    
    sizeof(char[]-type+1) isn't very useful. Since one of
    the strings is constant, we also don't need to use
    strncmp that string's length. While at it, str*cmp don't
    return booleans, so check for value instead of faux bools.
    
    Change-Id: Iebb194a60eac454dafeade75f135df92068cf4ab
    Found-by: Coverity Scan
    Signed-off-by: Patrick Georgi <patrick at georgi-clan.de>
---
 util/fletcher/fletcher.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/fletcher/fletcher.c b/util/fletcher/fletcher.c
index 3147d50..a572494 100644
--- a/util/fletcher/fletcher.c
+++ b/util/fletcher/fletcher.c
@@ -111,7 +111,7 @@ int main(int argc, char **argv)
 	checksum = fletcher32(&buffer[2], filesize/2 - 2);
 	*((uint32_t *)& buffer[2]) = checksum;
 #ifndef DEBUG
-	if ((argc == 2) && !strncmp(argv[1], debugoption, sizeof(debugoption+1))) {
+	if ((argc == 2) && (strcmp(argv[1], debugoption) == 0)) {
 #endif
 		fprintf(stderr, "Fletcher's Checksum: %x\n", checksum);
 #ifndef DEBUG



More information about the coreboot-gerrit mailing list