Attention is currently required from: Aarya, Alexander Goncharov, Nikolai Artemiev.

Alexander Goncharov uploaded patch set #3 to this change.

View Change

The following approvals got outdated and were removed: Verified+1 by build bot (Jenkins)

erasure_layout: don't copy region buffers if they're null/zero-size

memcpy() function expects 2nd parameter to be non-null. Make sure that
the pointer is non-null before passing it to the function.

Also move allocations under if conditions to avoid allocating memory for
a potentially 0 size.

Found-by: scan-build, clang v17.0.6
Signed-off-by: Alexander Goncharov <chat@joursoir.net>
Change-Id: I99aad4119f9c11bea75e3419926cc833bc1f68c5
---
M erasure_layout.c
1 file changed, 30 insertions(+), 24 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/48/81548/3

To view, visit change 81548. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: main
Gerrit-Change-Id: I99aad4119f9c11bea75e3419926cc833bc1f68c5
Gerrit-Change-Number: 81548
Gerrit-PatchSet: 3
Gerrit-Owner: Alexander Goncharov <chat@joursoir.net>
Gerrit-Reviewer: Aarya <aarya.chaumal@gmail.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev@chromium.org>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-Attention: Nikolai Artemiev <nartemiev@chromium.org>
Gerrit-Attention: Aarya <aarya.chaumal@gmail.com>
Gerrit-Attention: Alexander Goncharov <chat@joursoir.net>
Gerrit-MessageType: newpatchset