summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Georgi <patrick@georgi-clan.de>2014-09-29 10:12:29 +0200
committerPatrick Georgi <pgeorgi@google.com>2014-10-18 14:45:42 +0200
commit667c7a3b23e154254a4b91286cbb0f6aedf4c410 (patch)
treef6dad33a915b20b60b5659dc5e4bea87a394353c
parent02802dfa5a7dcc4b848e52123efaf3da2a17b295 (diff)
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@georgi-clan.de> Reviewed-on: http://review.coreboot.org/6988 Tested-by: build bot (Jenkins) Reviewed-by: Edward O'Callaghan <eocallaghan@alterapraxis.com>
-rw-r--r--util/fletcher/fletcher.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/util/fletcher/fletcher.c b/util/fletcher/fletcher.c
index 3147d50376..a5724943aa 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