Angel Pons has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/39973 )
Change subject: libflashrom.c: Use correct type for sizeof ......................................................................
libflashrom.c: Use correct type for sizeof
As we want to allocate an array of `flashrom_board_info` structs, use that type in sizeof. This did not cause problems as `board_info` was at least as big as `flashrom_board_info`, but nothing guarantees it.
Change-Id: I66e875d54c9a7cc59898b072b052282b0b5cbb2f Signed-off-by: Angel Pons th3fanbus@gmail.com --- M libflashrom.c 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/73/39973/1
diff --git a/libflashrom.c b/libflashrom.c index 0dec22e..ab7e364 100644 --- a/libflashrom.c +++ b/libflashrom.c @@ -182,7 +182,7 @@ ++boards_known_size;
struct flashrom_board_info *supported_boards = - malloc(boards_known_size * sizeof(*binfo)); + malloc(boards_known_size * sizeof(struct flashrom_board_info));
if (supported_boards != NULL) { for (; i < boards_known_size; ++i) {
HAOUAS Elyes has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/39973 )
Change subject: libflashrom.c: Use correct type for sizeof ......................................................................
Patch Set 3: Code-Review+1
(1 comment)
https://review.coreboot.org/c/flashrom/+/39973/3/libflashrom.c File libflashrom.c:
https://review.coreboot.org/c/flashrom/+/39973/3/libflashrom.c@191 PS3, Line 191: [Not linked to current change]
gcc-10 fails to compile here :
=1' -D'HAVE_UTSNAME=1' -D'HAVE_CLOCK_GETTIME=1' -D'FLASHROM_VERSION="v1.2-34-g021d179"' -o libflashrom.o -c libflashrom.c libflashrom.c: In function 'flashrom_supported_boards': libflashrom.c:191:32: error: implicit conversion from 'const enum test_state' to 'enum flashrom_test_state' [-Werror=enum-conversion] 191 | supported_boards[i].working = binfo[i].working; | ^ libflashrom.c: In function 'flashrom_supported_chipsets': libflashrom.c:229:33: error: implicit conversion from 'const enum test_state' to 'enum flashrom_test_state' [-Werror=enum-conversion] 229 | supported_chipsets[i].status = chipset[i].status; | ^ cc1: all warnings being treated as errors make: *** [Makefile:1194: libflashrom.o] Error 1
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/39973 )
Change subject: libflashrom.c: Use correct type for sizeof ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/flashrom/+/39973/3/libflashrom.c File libflashrom.c:
https://review.coreboot.org/c/flashrom/+/39973/3/libflashrom.c@191 PS3, Line 191:
[Not linked to current change] […]
As you said, this is not linked to the current change
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/39973 )
Change subject: libflashrom.c: Use correct type for sizeof ......................................................................
Patch Set 3: Code-Review+1
(1 comment)
https://review.coreboot.org/c/flashrom/+/39973/3//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/flashrom/+/39973/3//COMMIT_MSG@12 PS3, Line 12: Did some analyzer find this, or did you spot it?
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/39973 )
Change subject: libflashrom.c: Use correct type for sizeof ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/flashrom/+/39973/3//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/flashrom/+/39973/3//COMMIT_MSG@12 PS3, Line 12:
Did some analyzer find this, or did you spot it?
This was found by scan-build
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/39973 )
Change subject: libflashrom.c: Use correct type for sizeof ......................................................................
Patch Set 3: Code-Review+2
(1 comment)
https://review.coreboot.org/c/flashrom/+/39973/3/libflashrom.c File libflashrom.c:
https://review.coreboot.org/c/flashrom/+/39973/3/libflashrom.c@185 PS3, Line 185: struct flashrom_board_info I would write `*supported_boards` here. It's harder to break.
Michael Niewöhner has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/39973 )
Change subject: libflashrom.c: Use correct type for sizeof ......................................................................
Patch Set 3: Code-Review+1
Angel Pons has submitted this change. ( https://review.coreboot.org/c/flashrom/+/39973 )
Change subject: libflashrom.c: Use correct type for sizeof ......................................................................
libflashrom.c: Use correct type for sizeof
As we want to allocate an array of `flashrom_board_info` structs, use that type in sizeof. This did not cause problems as `board_info` was at least as big as `flashrom_board_info`, but nothing guarantees it.
Change-Id: I66e875d54c9a7cc59898b072b052282b0b5cbb2f Signed-off-by: Angel Pons th3fanbus@gmail.com Reviewed-on: https://review.coreboot.org/c/flashrom/+/39973 Reviewed-by: HAOUAS Elyes ehaouas@noos.fr Reviewed-by: Paul Menzel paulepanter@users.sourceforge.net Reviewed-by: Nico Huber nico.h@gmx.de Reviewed-by: Michael Niewöhner Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M libflashrom.c 1 file changed, 1 insertion(+), 1 deletion(-)
Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved Paul Menzel: Looks good to me, but someone else must approve HAOUAS Elyes: Looks good to me, but someone else must approve Michael Niewöhner: Looks good to me, but someone else must approve
diff --git a/libflashrom.c b/libflashrom.c index 0dec22e..ab7e364 100644 --- a/libflashrom.c +++ b/libflashrom.c @@ -182,7 +182,7 @@ ++boards_known_size;
struct flashrom_board_info *supported_boards = - malloc(boards_known_size * sizeof(*binfo)); + malloc(boards_known_size * sizeof(struct flashrom_board_info));
if (supported_boards != NULL) { for (; i < boards_known_size; ++i) {