Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/33459
Change subject: sb/nvidia/ck804: Prevent uninitialized reads ......................................................................
sb/nvidia/ck804: Prevent uninitialized reads
ck804_num counts the number of initialized elements in the busn and io_base arrays, so we can only access the first elements of those if ck804_num is non-zero.
Change-Id: I80b775370ac6485958948f0bff4510755a6cd2b8 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Found-by: Coverity CID 137058{1,3} --- M src/southbridge/nvidia/ck804/early_setup_car.c 1 file changed, 11 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/59/33459/1
diff --git a/src/southbridge/nvidia/ck804/early_setup_car.c b/src/southbridge/nvidia/ck804/early_setup_car.c index 156c387..03d34a3 100644 --- a/src/southbridge/nvidia/ck804/early_setup_car.c +++ b/src/southbridge/nvidia/ck804/early_setup_car.c @@ -355,11 +355,19 @@ } }
- printk(BIOS_DEBUG, "ck804_early_set_port(%d, %d, %d)\n", ck804_num, busn[0], io_base[0]); + if (ck804_num != 0) { + printk(BIOS_DEBUG, "ck804_early_set_port(%d, %d, %d)\n", + ck804_num, busn[0], io_base[0]); + printk(BIOS_DEBUG, "ck804_early_setup(%d, %d, %d)\n", + ck804_num, busn[0], io_base[0]); + printk(BIOS_DEBUG, "ck804_early_clear_port(%d, %d, %d)\n", + ck804_num, busn[0], io_base[0]); + } else { + printk(BIOS_DEBUG, "No ck804 early setup to do\n"); + } + ck804_early_set_port(ck804_num, busn, io_base); - printk(BIOS_DEBUG, "ck804_early_setup(%d, %d, %d)\n", ck804_num, busn[0], io_base[0]); ck804_early_setup(ck804_num, busn, io_base); - printk(BIOS_DEBUG, "ck804_early_clear_port(%d, %d, %d)\n", ck804_num, busn[0], io_base[0]); ck804_early_clear_port(ck804_num, busn, io_base);
return set_ht_link_ck804(4);
Jacob Garber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33459 )
Change subject: sb/nvidia/ck804: Prevent uninitialized reads ......................................................................
Patch Set 1:
These printk statements were added for debugging in a fix for another issue, so we could probably even remove them now...
Martin Roth has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33459 )
Change subject: sb/nvidia/ck804: Prevent uninitialized reads ......................................................................
Patch Set 1:
These printk statements were added for debugging in a fix for another issue, so we could probably even remove them now...
I'd vote to get rid of them or only print the values a single time.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33459 )
Change subject: sb/nvidia/ck804: Prevent uninitialized reads ......................................................................
Patch Set 1: Code-Review-1
(1 comment)
https://review.coreboot.org/#/c/33459/1/src/southbridge/nvidia/ck804/early_s... File src/southbridge/nvidia/ck804/early_setup_car.c:
https://review.coreboot.org/#/c/33459/1/src/southbridge/nvidia/ck804/early_s... PS1, Line 369: ck804_early_set_port(ck804_num, busn, io_base); : ck804_early_setup(ck804_num, busn, io_base); : ck804_early_clear_port(ck804_num, busn, io_base); This will still blow up if ck804_num is zero.
Jacob Garber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33459 )
Change subject: sb/nvidia/ck804: Prevent uninitialized reads ......................................................................
Patch Set 1:
(1 comment)
https://review.coreboot.org/#/c/33459/1/src/southbridge/nvidia/ck804/early_s... File src/southbridge/nvidia/ck804/early_setup_car.c:
https://review.coreboot.org/#/c/33459/1/src/southbridge/nvidia/ck804/early_s... PS1, Line 369: ck804_early_set_port(ck804_num, busn, io_base); : ck804_early_setup(ck804_num, busn, io_base); : ck804_early_clear_port(ck804_num, busn, io_base);
This will still blow up if ck804_num is zero.
Those use for loops to iterate over the initialized elements, so if ck804_num is zero they actually don't do anything (since there aren't any initialized elements to do anything with)
Hello Kyösti Mälkki, Timothy Pearson, Angel Pons, David Hendricks, build bot (Jenkins), Martin Roth, Patrick Georgi,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33459
to look at the new patch set (#2).
Change subject: sb/nvidia/ck804: Remove old debugging code ......................................................................
sb/nvidia/ck804: Remove old debugging code
These printk() statements were added in commit cdc526e582 when debugging another issue. They have undefined reads if ck804_num is 0 and aren't needed anymore, so drop them.
Change-Id: I80b775370ac6485958948f0bff4510755a6cd2b8 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Found-by: Coverity CID 137058{1,3} --- M src/southbridge/nvidia/ck804/early_setup_car.c 1 file changed, 0 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/59/33459/2
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33459 )
Change subject: sb/nvidia/ck804: Remove old debugging code ......................................................................
Patch Set 2: Code-Review+1
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33459 )
Change subject: sb/nvidia/ck804: Remove old debugging code ......................................................................
Patch Set 2:
(1 comment)
https://review.coreboot.org/#/c/33459/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/33459/2//COMMIT_MSG@9 PS2, Line 9: commit cdc526e582 Please add the summary in () behind the hash.
Hello Kyösti Mälkki, Timothy Pearson, Angel Pons, David Hendricks, build bot (Jenkins), Martin Roth, Patrick Georgi,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/33459
to look at the new patch set (#3).
Change subject: sb/nvidia/ck804: Remove old debugging code ......................................................................
sb/nvidia/ck804: Remove old debugging code
These printk() statements were added in commit cdc526e582 (southbridge/nvidia/ck804: Fix boot hang on ASUS KFSN4-DRE w/ K8 CPU) when debugging another issue. They have undefined reads if ck804_num is 0 and aren't needed anymore, so drop them.
Change-Id: I80b775370ac6485958948f0bff4510755a6cd2b8 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Found-by: Coverity CID 137058{1,3} --- M src/southbridge/nvidia/ck804/early_setup_car.c 1 file changed, 0 insertions(+), 3 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/59/33459/3
Jacob Garber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33459 )
Change subject: sb/nvidia/ck804: Remove old debugging code ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/#/c/33459/2//COMMIT_MSG Commit Message:
https://review.coreboot.org/#/c/33459/2//COMMIT_MSG@9 PS2, Line 9: commit cdc526e582
Please add the summary in () behind the hash.
Done
Patrick Georgi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/33459 )
Change subject: sb/nvidia/ck804: Remove old debugging code ......................................................................
Patch Set 3: Code-Review+2
Patrick Georgi has submitted this change and it was merged. ( https://review.coreboot.org/c/coreboot/+/33459 )
Change subject: sb/nvidia/ck804: Remove old debugging code ......................................................................
sb/nvidia/ck804: Remove old debugging code
These printk() statements were added in commit cdc526e582 (southbridge/nvidia/ck804: Fix boot hang on ASUS KFSN4-DRE w/ K8 CPU) when debugging another issue. They have undefined reads if ck804_num is 0 and aren't needed anymore, so drop them.
Change-Id: I80b775370ac6485958948f0bff4510755a6cd2b8 Signed-off-by: Jacob Garber jgarber1@ualberta.ca Found-by: Coverity CID 137058{1,3} Reviewed-on: https://review.coreboot.org/c/coreboot/+/33459 Reviewed-by: Patrick Georgi pgeorgi@google.com Reviewed-by: Angel Pons th3fanbus@gmail.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/southbridge/nvidia/ck804/early_setup_car.c 1 file changed, 0 insertions(+), 3 deletions(-)
Approvals: build bot (Jenkins): Verified Patrick Georgi: Looks good to me, approved Angel Pons: Looks good to me, but someone else must approve
diff --git a/src/southbridge/nvidia/ck804/early_setup_car.c b/src/southbridge/nvidia/ck804/early_setup_car.c index 156c387..e7a06f9 100644 --- a/src/southbridge/nvidia/ck804/early_setup_car.c +++ b/src/southbridge/nvidia/ck804/early_setup_car.c @@ -355,11 +355,8 @@ } }
- printk(BIOS_DEBUG, "ck804_early_set_port(%d, %d, %d)\n", ck804_num, busn[0], io_base[0]); ck804_early_set_port(ck804_num, busn, io_base); - printk(BIOS_DEBUG, "ck804_early_setup(%d, %d, %d)\n", ck804_num, busn[0], io_base[0]); ck804_early_setup(ck804_num, busn, io_base); - printk(BIOS_DEBUG, "ck804_early_clear_port(%d, %d, %d)\n", ck804_num, busn[0], io_base[0]); ck804_early_clear_port(ck804_num, busn, io_base);
return set_ht_link_ck804(4);