HAOUAS Elyes has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/33799
Change subject: src/lib/hexdump: Use size_t for lengths ......................................................................
src/lib/hexdump: Use size_t for lengths
Change-Id: I29a7ae8c499bb1e8ab7c8741b2dfb7663d82a362 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/lib/hexdump.c 1 file changed, 1 insertion(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/99/33799/1
diff --git a/src/lib/hexdump.c b/src/lib/hexdump.c index 1e689e3..511dedd 100644 --- a/src/lib/hexdump.c +++ b/src/lib/hexdump.c @@ -19,14 +19,13 @@
void hexdump(const void *memory, size_t length) { - int i; + size_t i, j; uint8_t *line; int all_zero = 0; int all_one = 0; size_t num_bytes;
for (i = 0; i < length; i += 16) { - int j; num_bytes = MIN(length - i, 16); line = ((uint8_t *)memory) + i;
HAOUAS Elyes has uploaded a new patch set (#2). ( https://review.coreboot.org/c/coreboot/+/33799 )
Change subject: src/lib/hexdump: Use size_t for lengths ......................................................................
src/lib/hexdump: Use size_t for lengths
Change-Id: I29a7ae8c499bb1e8ab7c8741b2dfb7663d82a362 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/lib/hexdump.c 1 file changed, 2 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/99/33799/2
Hello build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33799
to look at the new patch set (#3).
Change subject: src/lib/hexdump: Use size_t for length ......................................................................
src/lib/hexdump: Use size_t for length
Change-Id: I29a7ae8c499bb1e8ab7c8741b2dfb7663d82a362 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/lib/hexdump.c 1 file changed, 2 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/99/33799/3
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33799 )
Change subject: src/lib/hexdump: Use size_t for length ......................................................................
Patch Set 3: Code-Review+1
Jacob Garber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33799 )
Change subject: src/lib/hexdump: Use size_t for length ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/#/c/33799/3/src/lib/hexdump.c File src/lib/hexdump.c:
https://review.coreboot.org/#/c/33799/3/src/lib/hexdump.c@26 PS3, Line 26: int j, num_bytes It's probably better to have them both as size_t, since otherwise there will be a size_t -> int conversion warning when calculating num_bytes on line 29.
Hello Jacob Garber, Paul Menzel, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33799
to look at the new patch set (#4).
Change subject: src/lib/hexdump: Use size_t for length ......................................................................
src/lib/hexdump: Use size_t for length
Change-Id: I29a7ae8c499bb1e8ab7c8741b2dfb7663d82a362 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/lib/hexdump.c 1 file changed, 1 insertion(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/99/33799/4
Jacob Garber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33799 )
Change subject: src/lib/hexdump: Use size_t for length ......................................................................
Patch Set 4: Code-Review+2
Hello Jacob Garber, Paul Menzel, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33799
to look at the new patch set (#6).
Change subject: src/lib/hexdump: Use size_t for length ......................................................................
src/lib/hexdump: Use size_t for length
Spotted out using -Wconversion gcc warning option.
Change-Id: I29a7ae8c499bb1e8ab7c8741b2dfb7663d82a362 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/lib/hexdump.c 1 file changed, 1 insertion(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/99/33799/6
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33799 )
Change subject: src/lib/hexdump: Use size_t for length ......................................................................
Patch Set 6: Code-Review+1
(1 comment)
https://review.coreboot.org/c/coreboot/+/33799/6/src/lib/hexdump.c File src/lib/hexdump.c:
https://review.coreboot.org/c/coreboot/+/33799/6/src/lib/hexdump.c@67 PS6, Line 67: int I'd use size_t here as well
Jacob Garber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33799 )
Change subject: src/lib/hexdump: Use size_t for length ......................................................................
Patch Set 6:
(1 comment)
https://review.coreboot.org/c/coreboot/+/33799/6//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/33799/6//COMMIT_MSG@7 PS6, Line 7: length "indices" might be more accurate here than length
HAOUAS Elyes has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33799 )
Change subject: src/lib/hexdump: Use size_t for length ......................................................................
Patch Set 6:
(2 comments)
Thank you.
https://review.coreboot.org/c/coreboot/+/33799/6//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/33799/6//COMMIT_MSG@7 PS6, Line 7: length
"indices" might be more accurate here than length
Done
https://review.coreboot.org/c/coreboot/+/33799/6/src/lib/hexdump.c File src/lib/hexdump.c:
https://review.coreboot.org/c/coreboot/+/33799/6/src/lib/hexdump.c@67 PS6, Line 67: int
I'd use size_t here as well
Why? it is just a counter
Hello Angel Pons, Jacob Garber, Paul Menzel, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33799
to look at the new patch set (#7).
Change subject: src/lib/hexdump: Use size_t for indices ......................................................................
src/lib/hexdump: Use size_t for indices
Spotted out using -Wconversion gcc warning option.
Change-Id: I29a7ae8c499bb1e8ab7c8741b2dfb7663d82a362 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/lib/hexdump.c 1 file changed, 1 insertion(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/99/33799/7
Jacob Garber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33799 )
Change subject: src/lib/hexdump: Use size_t for indices ......................................................................
Patch Set 7:
(1 comment)
https://review.coreboot.org/c/coreboot/+/33799/6/src/lib/hexdump.c File src/lib/hexdump.c:
https://review.coreboot.org/c/coreboot/+/33799/6/src/lib/hexdump.c@67 PS6, Line 67: int
Why? […]
I suppose the argument could be made that since its value at the end of the while loop will be the original value of len (since it is incremented every time len is decremented), that this should also be a size_t (since the range of an int is less than the range of a size_t).
Hello Angel Pons, Jacob Garber, Paul Menzel, build bot (Jenkins),
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33799
to look at the new patch set (#8).
Change subject: src/lib/hexdump: Use size_t for indices ......................................................................
src/lib/hexdump: Use size_t for indices
Spotted out using -Wconversion gcc warning option.
Change-Id: I29a7ae8c499bb1e8ab7c8741b2dfb7663d82a362 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr --- M src/lib/hexdump.c 1 file changed, 2 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/99/33799/8
Jacob Garber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33799 )
Change subject: src/lib/hexdump: Use size_t for indices ......................................................................
Patch Set 8: Code-Review+2
(2 comments)
https://review.coreboot.org/c/coreboot/+/33799/3/src/lib/hexdump.c File src/lib/hexdump.c:
https://review.coreboot.org/c/coreboot/+/33799/3/src/lib/hexdump.c@26 PS3, Line 26: int j, num_bytes
It's probably better to have them both as size_t, since otherwise there will be a size_t -> int conv […]
Done
https://review.coreboot.org/c/coreboot/+/33799/6/src/lib/hexdump.c File src/lib/hexdump.c:
https://review.coreboot.org/c/coreboot/+/33799/6/src/lib/hexdump.c@67 PS6, Line 67: int
I suppose the argument could be made that since its value at the end of the while loop will be the o […]
Done
Patrick Georgi has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/33799 )
Change subject: src/lib/hexdump: Use size_t for indices ......................................................................
src/lib/hexdump: Use size_t for indices
Spotted out using -Wconversion gcc warning option.
Change-Id: I29a7ae8c499bb1e8ab7c8741b2dfb7663d82a362 Signed-off-by: Elyes HAOUAS ehaouas@noos.fr Reviewed-on: https://review.coreboot.org/c/coreboot/+/33799 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Jacob Garber jgarber1@ualberta.ca --- M src/lib/hexdump.c 1 file changed, 2 insertions(+), 3 deletions(-)
Approvals: build bot (Jenkins): Verified Jacob Garber: Looks good to me, approved
diff --git a/src/lib/hexdump.c b/src/lib/hexdump.c index 1e689e3..2c9e483 100644 --- a/src/lib/hexdump.c +++ b/src/lib/hexdump.c @@ -19,14 +19,13 @@
void hexdump(const void *memory, size_t length) { - int i; + size_t i, j; uint8_t *line; int all_zero = 0; int all_one = 0; size_t num_bytes;
for (i = 0; i < length; i += 16) { - int j; num_bytes = MIN(length - i, 16); line = ((uint8_t *)memory) + i;
@@ -65,7 +64,7 @@
void hexdump32(char LEVEL, const void *d, size_t len) { - int count = 0; + size_t count = 0;
while (len > 0) { if (count % 8 == 0) {