John Zhao has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/42837 )
Change subject: soc/amd/picasso: Avoid NULL pointer dereference ......................................................................
soc/amd/picasso: Avoid NULL pointer dereference
Coverity detects dereferencing a pointer that might be "NULL" when calling acpigen_write_scope. Add sanity check for scope to prevent NULL pointer dereference.
BUG=CID 1429980 TEST=None
Signed-off-by: John Zhao john.zhao@intel.com Change-Id: I6214fb83bccb19fe4edad65ce6b862815b8dcec6 --- M src/soc/amd/picasso/root_complex.c 1 file changed, 4 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/42837/1
diff --git a/src/soc/amd/picasso/root_complex.c b/src/soc/amd/picasso/root_complex.c index 4930a0e..807e205 100644 --- a/src/soc/amd/picasso/root_complex.c +++ b/src/soc/amd/picasso/root_complex.c @@ -134,8 +134,11 @@ static void root_complex_fill_ssdt(const struct device *device) { msr_t msr; + const char *scope = acpi_device_scope(device); + if (!scope) + return;
- acpigen_write_scope(acpi_device_scope(device)); + acpigen_write_scope(scope);
msr = rdmsr(TOP_MEM); acpigen_write_name_dword("TOM1", msr.lo);
Hello build bot (Jenkins), Paul Menzel,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/42837
to look at the new patch set (#2).
Change subject: soc/amd/picasso: Avoid NULL pointer dereference ......................................................................
soc/amd/picasso: Avoid NULL pointer dereference
Coverity detects dereferencing a pointer that might be "NULL" when calling acpigen_write_scope. Add sanity check for scope to prevent NULL pointer dereference.
Found-by: Coverity CID 1429980 TEST=None
Signed-off-by: John Zhao john.zhao@intel.com Change-Id: I6214fb83bccb19fe4edad65ce6b862815b8dcec6 --- M src/soc/amd/picasso/root_complex.c 1 file changed, 4 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/42837/2
Patrick Rudolph has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42837 )
Change subject: soc/amd/picasso: Avoid NULL pointer dereference ......................................................................
Patch Set 2: Code-Review+2
Hello build bot (Jenkins), Paul Menzel, Patrick Rudolph,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/42837
to look at the new patch set (#3).
Change subject: soc/amd/picasso: Avoid NULL pointer dereference ......................................................................
soc/amd/picasso: Avoid NULL pointer dereference
Coverity detects dereferencing a pointer that might be "NULL" when calling acpigen_write_scope. Add sanity check for scope to prevent NULL pointer dereference.
Found-by: Coverity CID 1429980 TEST=None
Signed-off-by: John Zhao john.zhao@intel.com Change-Id: I6214fb83bccb19fe4edad65ce6b862815b8dcec6 --- M src/soc/amd/picasso/root_complex.c 1 file changed, 5 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/42837/3
Hello build bot (Jenkins), Paul Menzel, Patrick Rudolph,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/42837
to look at the new patch set (#4).
Change subject: soc/amd/picasso: Avoid NULL pointer dereference ......................................................................
soc/amd/picasso: Avoid NULL pointer dereference
Coverity detects dereferencing a pointer that might be "NULL" when calling acpigen_write_scope. Add sanity check for scope to prevent NULL pointer dereference.
Found-by: Coverity CID 1429980 TEST=None
Signed-off-by: John Zhao john.zhao@intel.com Change-Id: I6214fb83bccb19fe4edad65ce6b862815b8dcec6 --- M src/soc/amd/picasso/root_complex.c 1 file changed, 7 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/42837/4
Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42837 )
Change subject: soc/amd/picasso: Avoid NULL pointer dereference ......................................................................
Patch Set 4:
(1 comment)
https://review.coreboot.org/c/coreboot/+/42837/4/src/soc/amd/picasso/root_co... File src/soc/amd/picasso/root_complex.c:
https://review.coreboot.org/c/coreboot/+/42837/4/src/soc/amd/picasso/root_co... PS4, Line 146: if (!scope) { I really think these checks should be an assert(). It's not possible for device to be NULL.
Hello build bot (Jenkins), Tim Wawrzynczak, Paul Menzel, Patrick Rudolph,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/42837
to look at the new patch set (#5).
Change subject: soc/amd/picasso: Avoid NULL pointer dereference ......................................................................
soc/amd/picasso: Avoid NULL pointer dereference
Coverity detects dereferencing a pointer that might be "NULL" when calling acpigen_write_scope. Add sanity check for scope to prevent NULL pointer dereference.
Found-by: Coverity CID 1429980 TEST=None
Signed-off-by: John Zhao john.zhao@intel.com Change-Id: I6214fb83bccb19fe4edad65ce6b862815b8dcec6 --- M src/soc/amd/picasso/root_complex.c 1 file changed, 4 insertions(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/42837/5
John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42837 )
Change subject: soc/amd/picasso: Avoid NULL pointer dereference ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/42837/4/src/soc/amd/picasso/root_co... File src/soc/amd/picasso/root_complex.c:
https://review.coreboot.org/c/coreboot/+/42837/4/src/soc/amd/picasso/root_co... PS4, Line 146: if (!scope) {
I really think these checks should be an assert(). It's not possible for device to be NULL.
Done
Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42837 )
Change subject: soc/amd/picasso: Avoid NULL pointer dereference ......................................................................
Patch Set 5:
(1 comment)
https://review.coreboot.org/c/coreboot/+/42837/5/src/soc/amd/picasso/root_co... File src/soc/amd/picasso/root_complex.c:
https://review.coreboot.org/c/coreboot/+/42837/5/src/soc/amd/picasso/root_co... PS5, Line 139: if (!device) { I was hoping we could do the device check as an assert as well.
Hello build bot (Jenkins), Tim Wawrzynczak, Paul Menzel, Patrick Rudolph,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/42837
to look at the new patch set (#6).
Change subject: soc/amd/picasso: Avoid NULL pointer dereference ......................................................................
soc/amd/picasso: Avoid NULL pointer dereference
Coverity detects dereferencing a pointer that might be "NULL" when calling acpigen_write_scope. Add sanity check for scope to prevent NULL pointer dereference.
Found-by: Coverity CID 1429980 TEST=None
Signed-off-by: John Zhao john.zhao@intel.com Change-Id: I6214fb83bccb19fe4edad65ce6b862815b8dcec6 --- M src/soc/amd/picasso/root_complex.c 1 file changed, 6 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/42837/6
Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42837 )
Change subject: soc/amd/picasso: Avoid NULL pointer dereference ......................................................................
Patch Set 6:
(1 comment)
https://review.coreboot.org/c/coreboot/+/42837/6/src/soc/amd/picasso/root_co... File src/soc/amd/picasso/root_complex.c:
https://review.coreboot.org/c/coreboot/+/42837/6/src/soc/amd/picasso/root_co... PS6, Line 140: dev This would need to be 'device'
John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42837 )
Change subject: soc/amd/picasso: Avoid NULL pointer dereference ......................................................................
Patch Set 6:
(1 comment)
https://review.coreboot.org/c/coreboot/+/42837/6/src/soc/amd/picasso/root_co... File src/soc/amd/picasso/root_complex.c:
https://review.coreboot.org/c/coreboot/+/42837/6/src/soc/amd/picasso/root_co... PS6, Line 140: dev
This would need to be 'device'
Done
Hello build bot (Jenkins), Tim Wawrzynczak, Paul Menzel, Patrick Rudolph,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/42837
to look at the new patch set (#7).
Change subject: soc/amd/picasso: Avoid NULL pointer dereference ......................................................................
soc/amd/picasso: Avoid NULL pointer dereference
Coverity detects dereferencing a pointer that might be "NULL" when calling acpigen_write_scope. Add sanity check for scope to prevent NULL pointer dereference.
Found-by: Coverity CID 1429980 TEST=None
Signed-off-by: John Zhao john.zhao@intel.com Change-Id: I6214fb83bccb19fe4edad65ce6b862815b8dcec6 --- M src/soc/amd/picasso/root_complex.c 1 file changed, 6 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/42837/7
Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42837 )
Change subject: soc/amd/picasso: Avoid NULL pointer dereference ......................................................................
Patch Set 7: Code-Review+2
John Zhao has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/42837 )
Change subject: soc/amd/picasso: Avoid NULL pointer dereference ......................................................................
Patch Set 7:
(1 comment)
https://review.coreboot.org/c/coreboot/+/42837/5/src/soc/amd/picasso/root_co... File src/soc/amd/picasso/root_complex.c:
https://review.coreboot.org/c/coreboot/+/42837/5/src/soc/amd/picasso/root_co... PS5, Line 139: if (!device) {
I was hoping we could do the device check as an assert as well.
Done
Aaron Durbin has submitted this change. ( https://review.coreboot.org/c/coreboot/+/42837 )
Change subject: soc/amd/picasso: Avoid NULL pointer dereference ......................................................................
soc/amd/picasso: Avoid NULL pointer dereference
Coverity detects dereferencing a pointer that might be "NULL" when calling acpigen_write_scope. Add sanity check for scope to prevent NULL pointer dereference.
Found-by: Coverity CID 1429980 TEST=None
Signed-off-by: John Zhao john.zhao@intel.com Change-Id: I6214fb83bccb19fe4edad65ce6b862815b8dcec6 Reviewed-on: https://review.coreboot.org/c/coreboot/+/42837 Reviewed-by: Aaron Durbin adurbin@chromium.org Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/soc/amd/picasso/root_complex.c 1 file changed, 6 insertions(+), 6 deletions(-)
Approvals: build bot (Jenkins): Verified Aaron Durbin: Looks good to me, approved
diff --git a/src/soc/amd/picasso/root_complex.c b/src/soc/amd/picasso/root_complex.c index 036ff00..1c06928 100644 --- a/src/soc/amd/picasso/root_complex.c +++ b/src/soc/amd/picasso/root_complex.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */
#include <acpi/acpigen.h> +#include <assert.h> #include <cbmem.h> #include <console/console.h> #include <cpu/amd/msr.h> @@ -134,14 +135,13 @@ static void root_complex_fill_ssdt(const struct device *device) { msr_t msr; + const char *scope;
- if (!device) { - printk(BIOS_ERR, "%s: device is NULL! ACPI SSDT will be incomplete.\n", - __func__); - return; - } + assert(device);
- acpigen_write_scope(acpi_device_scope(device)); + scope = acpi_device_scope(device); + assert(scope); + acpigen_write_scope(scope);
msr = rdmsr(TOP_MEM); acpigen_write_name_dword("TOM1", msr.lo);