Hello Hsuan Ting Chen,
I'd like you to do a code review. Please visit
https://review.coreboot.org/c/coreboot/+/45465
to review the following change.
Change subject: libpayload: free: Separate NULL check out for clarity ......................................................................
libpayload: free: Separate NULL check out for clarity
Separate the validity check of calling free(NULL) for clarity.
BUG=b:168441735 TEST=emerge-puff libpayload
Change-Id: I0dc355553410bbe59e658945fb40c05f5f709380 Signed-off-by: Hsuan Ting Chen roccochen@chromium.org --- M payloads/libpayload/libc/malloc.c 1 file changed, 4 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/65/45465/1
diff --git a/payloads/libpayload/libc/malloc.c b/payloads/libpayload/libc/malloc.c index 48bf32e..20f9ef3 100644 --- a/payloads/libpayload/libc/malloc.c +++ b/payloads/libpayload/libc/malloc.c @@ -246,6 +246,10 @@ hdrtype_t hdr; struct memory_type *type = heap;
+ /* No action occurs on NULL. */ + if (ptr == NULL) + return; + /* Sanity check. */ if (ptr < type->start || ptr >= type->end) { type = dma;
Paul Menzel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45465 )
Change subject: libpayload: free: Separate NULL check out for clarity ......................................................................
Patch Set 1: Code-Review+1
Werner Zeh has removed Name of user not set #1003096 from this change. ( https://review.coreboot.org/c/coreboot/+/45465 )
Change subject: libpayload: free: Separate NULL check out for clarity ......................................................................
Removed reviewer null with the following votes:
* Verified+1 by Name of user not set (1003096)
Hung-Te Lin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45465 )
Change subject: libpayload: free: Separate NULL check out for clarity ......................................................................
Patch Set 1: Code-Review+2
Yu-Ping Wu has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45465 )
Change subject: libpayload: free: Separate NULL check out for clarity ......................................................................
Patch Set 1: Code-Review+2
Hung-Te Lin has submitted this change. ( https://review.coreboot.org/c/coreboot/+/45465 )
Change subject: libpayload: free: Separate NULL check out for clarity ......................................................................
libpayload: free: Separate NULL check out for clarity
Separate the validity check of calling free(NULL) for clarity.
BUG=b:168441735 TEST=emerge-puff libpayload
Change-Id: I0dc355553410bbe59e658945fb40c05f5f709380 Signed-off-by: Hsuan Ting Chen roccochen@chromium.org Reviewed-on: https://review.coreboot.org/c/coreboot/+/45465 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Paul Menzel paulepanter@users.sourceforge.net Reviewed-by: Hung-Te Lin hungte@chromium.org Reviewed-by: Yu-Ping Wu yupingso@google.com --- M payloads/libpayload/libc/malloc.c 1 file changed, 4 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Paul Menzel: Looks good to me, but someone else must approve Hung-Te Lin: Looks good to me, approved Yu-Ping Wu: Looks good to me, approved
diff --git a/payloads/libpayload/libc/malloc.c b/payloads/libpayload/libc/malloc.c index 48bf32e..20f9ef3 100644 --- a/payloads/libpayload/libc/malloc.c +++ b/payloads/libpayload/libc/malloc.c @@ -246,6 +246,10 @@ hdrtype_t hdr; struct memory_type *type = heap;
+ /* No action occurs on NULL. */ + if (ptr == NULL) + return; + /* Sanity check. */ if (ptr < type->start || ptr >= type->end) { type = dma;
9elements QA has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45465 )
Change subject: libpayload: free: Separate NULL check out for clarity ......................................................................
Patch Set 2:
Automatic boot test returned (PASS/FAIL/TOTAL): 8/1/9 "QEMU x86 q35/ich9" (x86_32) using payload TianoCore : SUCCESS : https://lava.9esec.io/r/20028 "QEMU x86 q35/ich9" (x86_32) using payload SeaBIOS : SUCCESS : https://lava.9esec.io/r/20027 "QEMU x86 i440fx/piix4" (x86_64) using payload SeaBIOS : FAIL : https://lava.9esec.io/r/20026 "QEMU x86 i440fx/piix4" (x86_32) using payload SeaBIOS : SUCCESS : https://lava.9esec.io/r/20025 "QEMU AArch64" using payload LinuxBoot_u-root_kexec : SUCCESS : https://lava.9esec.io/r/20024 "HP Z220 SFF Workstation" (x86_32) using payload LinuxBoot_BusyBox_kexec : SUCCESS : https://lava.9esec.io/r/20032 "HP Z220 SFF Workstation" (x86_32) using payload LinuxBoot_BusyBox_kexec : SUCCESS : https://lava.9esec.io/r/20031 "HP Compaq 8200 Elite SFF PC" (x86_32) using payload TianoCore : SUCCESS : https://lava.9esec.io/r/20030 "HP Compaq 8200 Elite SFF PC" (x86_32) using payload SeaBIOS : SUCCESS : https://lava.9esec.io/r/20029
Please note: This test is under development and might not be accurate at all!