Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/47062 )
Change subject: search.c: Fix warnings ......................................................................
search.c: Fix warnings
Change-Id: I9f5e9e5a799a1d702381d48682b536e6d53331ad Signed-off-by: Edward O'Callaghan quasisec@google.com --- M search.c 1 file changed, 5 insertions(+), 9 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/62/47062/1
diff --git a/search.c b/search.c index 1a9f197..0801a14 100644 --- a/search.c +++ b/search.c @@ -79,19 +79,16 @@ search->state = SEARCH_STATE_USE_HANDLER; search->stride = search->ceiling_size / 2; search->offset = search->ceiling_size - search->stride; - /* no break */ + /* fallthrough */ case SEARCH_STATE_USE_HANDLER: search->state = SEARCH_STATE_BINARY_SEARCH; search->offset = search->ceiling_size - search->stride; if (search->handler) { ret = search->handler(search, offsetp); - if (!ret && - (*offsetp < - (search->total_size - search->min_size)) && - (*offsetp >= 0)) + if (!ret && ((size_t)*offsetp < (search->total_size - search->min_size)) && (*offsetp >= 0)) return 0; } - /* no break */ + /* fallthrough */ case SEARCH_STATE_BINARY_SEARCH: /* * For efficient operation, we start with the largest stride @@ -127,8 +124,7 @@ if (search->offset < 0) { search->stride /= 2; search->offset = search->ceiling_size - search->stride; - while (search->offset > - (search->total_size - search->min_size)) + while ((size_t)search->offset > (search->total_size - search->min_size)) search->offset -= search->stride; if (search->stride < 16) { search->state = SEARCH_STATE_FULL_SEARCH; @@ -163,7 +159,7 @@ */ do { *offsetp = search->offset--; - } while (*offsetp > search->total_size - search->min_size); + } while ((size_t)*offsetp > search->total_size - search->min_size); if (search->offset < 0) search->state = SEARCH_STATE_DONE; return 0;