Harshit Sharma has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/41654 )
Change subject: drivers/ipmi: Avoid NULL pointer dereference ......................................................................
drivers/ipmi: Avoid NULL pointer dereference
There are multiple instances where NULL pointer conf could be dereferenced. This patch fixes those issues.
Found-by: Coverity Scan #1407751, #1428709, #1428710, #1428714 Signed-off-by: Harshit Sharma harshitsharmajs@gmail.com Change-Id: I2d1cfe3f9b55288eeb55ab8785d857993e3989c0 --- M src/drivers/ipmi/ipmi_kcs_ops.c 1 file changed, 9 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/54/41654/1
diff --git a/src/drivers/ipmi/ipmi_kcs_ops.c b/src/drivers/ipmi/ipmi_kcs_ops.c index 0b90fb2..e43f3a5 100644 --- a/src/drivers/ipmi/ipmi_kcs_ops.c +++ b/src/drivers/ipmi/ipmi_kcs_ops.c @@ -84,6 +84,9 @@ if (dev->chip_info) conf = dev->chip_info;
+ if (!conf) + return; + /* Get IPMI version for ACPI and SMBIOS */ if (conf && conf->wait_for_bmc && conf->bmc_boot_timeout) { struct stopwatch sw; @@ -200,6 +203,9 @@ if (dev->chip_info) conf = dev->chip_info;
+ if (!conf) + return 0; + if (conf) { if (conf->have_gpe) gpe_interrupt = conf->gpe_interrupt; @@ -234,6 +240,9 @@ if (dev->chip_info) conf = dev->chip_info;
+ if (!conf) + return; + /* Use command to pass UID to ipmi_write_acpi_tables */ conf->uid = uid_cnt++;
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41654 )
Change subject: drivers/ipmi: Avoid NULL pointer dereference ......................................................................
Patch Set 1: Code-Review+1
(1 comment)
I'm not sure if we assume chip_info to never be NULL.
https://review.coreboot.org/c/coreboot/+/41654/1//COMMIT_MSG Commit Message:
https://review.coreboot.org/c/coreboot/+/41654/1//COMMIT_MSG@9 PS1, Line 9: dereferenced. Move this to the next line
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41654 )
Change subject: drivers/ipmi: Avoid NULL pointer dereference ......................................................................
Patch Set 1: Code-Review-1
That's not a proper fix.
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41654 )
Change subject: drivers/ipmi: Avoid NULL pointer dereference ......................................................................
Patch Set 1: -Code-Review
Patch Set 1: Code-Review-1
That's not a proper fix.
Why so? What would be a proper fix?
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41654 )
Change subject: drivers/ipmi: Avoid NULL pointer dereference ......................................................................
Patch Set 1:
Check the pointer before using it and handle that case gracefully. If we know that it's never going to be NULL you can use an assertion. That should also silence the static code analyser.
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41654 )
Change subject: drivers/ipmi: Avoid NULL pointer dereference ......................................................................
Patch Set 1:
(3 comments)
https://review.coreboot.org/c/coreboot/+/41654/1/src/drivers/ipmi/ipmi_kcs_o... File src/drivers/ipmi/ipmi_kcs_ops.c:
https://review.coreboot.org/c/coreboot/+/41654/1/src/drivers/ipmi/ipmi_kcs_o... PS1, Line 91: conf That condition is now always true and thus obsolete
https://review.coreboot.org/c/coreboot/+/41654/1/src/drivers/ipmi/ipmi_kcs_o... PS1, Line 207: ; return current
https://review.coreboot.org/c/coreboot/+/41654/1/src/drivers/ipmi/ipmi_kcs_o... PS1, Line 209: conf Always true
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41654 )
Change subject: drivers/ipmi: Avoid NULL pointer dereference ......................................................................
Patch Set 1:
(2 comments)
https://review.coreboot.org/c/coreboot/+/41654/1/src/drivers/ipmi/ipmi_kcs_o... File src/drivers/ipmi/ipmi_kcs_ops.c:
https://review.coreboot.org/c/coreboot/+/41654/1/src/drivers/ipmi/ipmi_kcs_o... PS1, Line 254: acpigen_write_name_byte("_UID", conf->uid); Should we skip _UID and generate the rest of entries as usual?
https://review.coreboot.org/c/coreboot/+/41654/1/src/drivers/ipmi/ipmi_kcs_o... PS1, Line 262: if (conf) { always true
Harshit Sharma has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41654 )
Change subject: drivers/ipmi: Avoid NULL pointer dereference ......................................................................
Patch Set 1:
Patch Set 1:
(3 comments)
Since conf will always be true, should we just put assert statements at those three places?
Hello build bot (Jenkins), Patrick Rudolph, Angel Pons, Werner Zeh,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/41654
to look at the new patch set (#2).
Change subject: drivers/ipmi: Avoid NULL pointer dereference ......................................................................
drivers/ipmi: Avoid NULL pointer dereference
There are multiple instances where NULL pointer conf could be dereferenced. This patch fixes those issues.
Found-by: Coverity Scan #1407751, #1428709, #1428710, #1428714 Signed-off-by: Harshit Sharma harshitsharmajs@gmail.com Change-Id: I2d1cfe3f9b55288eeb55ab8785d857993e3989c0 --- M src/drivers/ipmi/ipmi_kcs_ops.c 1 file changed, 6 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/54/41654/2
Hello build bot (Jenkins), Patrick Rudolph, Angel Pons, Werner Zeh,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/41654
to look at the new patch set (#3).
Change subject: drivers/ipmi: Avoid NULL pointer dereference ......................................................................
drivers/ipmi: Avoid NULL pointer dereference
There are multiple instances where NULL pointer conf could be dereferenced. This patch fixes those issues.
Found-by: Coverity Scan #1407751, #1428709, #1428710, #1428714 Signed-off-by: Harshit Sharma harshitsharmajs@gmail.com Change-Id: I2d1cfe3f9b55288eeb55ab8785d857993e3989c0 --- M src/drivers/ipmi/ipmi_kcs_ops.c 1 file changed, 7 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/54/41654/3
Bill XIE has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41654 )
Change subject: drivers/ipmi: Avoid NULL pointer dereference ......................................................................
Patch Set 3:
How about to make code runnable even if dev->chip_info is NULL? Like my approach at I1d694b12f6c42961c104fe839d4ee46c0f111197 .
Michael Niewöhner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41654 )
Change subject: drivers/ipmi: Avoid NULL pointer dereference ......................................................................
Patch Set 3:
Since CB:47387 is merged now, would you mind rerunning your coverty scans?
Harshit Sharma has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41654 )
Change subject: drivers/ipmi: Avoid NULL pointer dereference ......................................................................
Patch Set 3:
Patch Set 3:
Since CB:47387 is merged now, would you mind rerunning your coverty scans?
Yes, these issues have been fixed. I think I can abandon this change now.
Michael Niewöhner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41654 )
Change subject: drivers/ipmi: Avoid NULL pointer dereference ......................................................................
Patch Set 3:
Patch Set 3:
Patch Set 3:
Since CB:47387 is merged now, would you mind rerunning your coverty scans?
Yes, these issues have been fixed. I think I can abandon this change now.
Great, thanks!
Harshit Sharma has abandoned this change. ( https://review.coreboot.org/c/coreboot/+/41654 )
Change subject: drivers/ipmi: Avoid NULL pointer dereference ......................................................................
Abandoned