summaryrefslogtreecommitdiffstats
path: root/util/ich_descriptors_tool
diff options
context:
space:
mode:
authorAnastasia Klimchuk <aklm@chromium.org>2022-04-08 15:34:20 +1000
committerAnastasia Klimchuk <aklm@chromium.org>2022-04-29 04:24:15 +0000
commitf81c1c9d0ad8e83649e5bc3c7052e0c67aff0ba6 (patch)
treee871d552250f774d451c09c450acc9a431fee24f /util/ich_descriptors_tool
parent87d7b110d6ed6d4ef0b61e777f2fee3c10808f0b (diff)
downloadflashrom-f81c1c9d0ad8e83649e5bc3c7052e0c67aff0ba6.tar.gz
flashrom-f81c1c9d0ad8e83649e5bc3c7052e0c67aff0ba6.tar.bz2
flashrom-f81c1c9d0ad8e83649e5bc3c7052e0c67aff0ba6.zip
ich_descriptors_tool: Fix -Wsign-compare warnings
This patch is fixing -Wsign-compare warnings, specifically: warning: comparison of integer expressions of different signedness: ‘int’ and ‘uint32_t’ {aka ‘unsigned int’} [-Wsign-compare] Both instances in this patch produce the same warning. The patch is needed to sync compiler warning options between meson and makefile. TEST=running the following gives no warnings: meson setup --wipe (to clean build directory) ninja test Change-Id: I1f9325e9cf89f57f18d63cc3906a0958b47286d7 Signed-off-by: Anastasia Klimchuk <aklm@chromium.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/63488 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Thomas Heijligen <src@posteo.de> Reviewed-by: Felix Singer <felixsinger@posteo.net>
Diffstat (limited to 'util/ich_descriptors_tool')
-rw-r--r--util/ich_descriptors_tool/ich_descriptors_tool.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/util/ich_descriptors_tool/ich_descriptors_tool.c b/util/ich_descriptors_tool/ich_descriptors_tool.c
index 49512064a..a5a59ad29 100644
--- a/util/ich_descriptors_tool/ich_descriptors_tool.c
+++ b/util/ich_descriptors_tool/ich_descriptors_tool.c
@@ -46,7 +46,6 @@ static const char *const region_names[] = {
static void dump_file(const char *prefix, const uint32_t *dump, unsigned int len,
const struct ich_desc_region *const reg, unsigned int i)
{
- int ret;
char *fn;
const char *reg_name;
uint32_t file_len;
@@ -85,8 +84,8 @@ static void dump_file(const char *prefix, const uint32_t *dump, unsigned int len
}
free(fn);
- ret = write(fh, &dump[base >> 2], file_len);
- if (ret != file_len) {
+ const ssize_t ret = write(fh, &dump[base >> 2], file_len);
+ if (ret < 0 || ((size_t) ret) != file_len) {
fprintf(stderr, "FAILED.\n");
exit(1);
}
@@ -270,7 +269,8 @@ int main(int argc, char *argv[])
prettyprint_ich_descriptors(cs, &desc);
pMAC = (uint8_t *) &buf[ICH_FREG_BASE(desc.region.FLREGs[3]) >> 2];
- if (len >= ICH_FREG_BASE(desc.region.FLREGs[3]) + 6 && pMAC[0] != 0xff)
+ /* The case len < 0 is handled above as error. At this point len is non-negative. */
+ if (((size_t) len) >= ICH_FREG_BASE(desc.region.FLREGs[3]) + 6 && pMAC[0] != 0xff)
printf("The MAC address might be at offset 0x%x: "
"%02x:%02x:%02x:%02x:%02x:%02x\n",
ICH_FREG_BASE(desc.region.FLREGs[3]),