Nico Huber submitted this change.

View Change

Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved Jacob Garber: Looks good to me, approved
Fix more sign-compare issues

The one in the `dummyflasher` is a little peculiar. We actually never
knew the type of the `st_size` field in `struct stat`. It happens to
be `signed` in some systems (e.g. DJGPP).

Change-Id: If36ba22606021400b385ea6083eacc7b360c20c5
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/35800
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jacob Garber <jgarber1@ualberta.ca>
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
---
M dediprog.c
M dummyflasher.c
M ich_descriptors.c
M libflashrom.c
4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dediprog.c b/dediprog.c
index fbd6930..e4124b0 100644
--- a/dediprog.c
+++ b/dediprog.c
@@ -1038,7 +1038,7 @@
free(device);
return 1;
}
- if (usedevice < 0 || usedevice > UINT_MAX) {
+ if (usedevice < 0 || usedevice > INT_MAX) {
msg_perr("Error: Value for 'device' is out of range.\n");
free(device);
return 1;
diff --git a/dummyflasher.c b/dummyflasher.c
index 2d7fa85..b9f6126 100644
--- a/dummyflasher.c
+++ b/dummyflasher.c
@@ -387,7 +387,7 @@
if (!stat(emu_persistent_image, &image_stat)) {
msg_pdbg("Found persistent image %s, %jd B ",
emu_persistent_image, (intmax_t)image_stat.st_size);
- if (image_stat.st_size == emu_chip_size) {
+ if ((uintmax_t)image_stat.st_size == emu_chip_size) {
msg_pdbg("matches.\n");
msg_pdbg("Reading %s\n", emu_persistent_image);
if (read_buf_from_file(flashchip_contents, emu_chip_size,
diff --git a/ich_descriptors.c b/ich_descriptors.c
index 6d7b020..120d3fe 100644
--- a/ich_descriptors.c
+++ b/ich_descriptors.c
@@ -421,7 +421,7 @@
for (i = 0; i < nm; i++) {
size_t j;
msg_pdbg2("%-4s", master_names[i]);
- for (j = 0; j < min(num_regions, 12); j++)
+ for (j = 0; j < (size_t)min(num_regions, 12); j++)
msg_pdbg2(" %c%c ",
desc->master.mstr[i].read & (1 << j) ? 'r' : ' ',
desc->master.mstr[i].write & (1 << j) ? 'w' : ' ');
diff --git a/libflashrom.c b/libflashrom.c
index dbc5129..1d8a9ae 100644
--- a/libflashrom.c
+++ b/libflashrom.c
@@ -139,7 +139,7 @@
*/
struct flashrom_flashchip_info *flashrom_supported_flash_chips(void)
{
- int i = 0;
+ unsigned int i = 0;
struct flashrom_flashchip_info *supported_flashchips =
malloc(flashchips_size * sizeof(*supported_flashchips));


To view, visit change 35800. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: If36ba22606021400b385ea6083eacc7b360c20c5
Gerrit-Change-Number: 35800
Gerrit-PatchSet: 4
Gerrit-Owner: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Jacob Garber <jgarber1@ualberta.ca>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Patrick Georgi <pgeorgi@google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged