Attention is currently required from: Angel Pons, Light, Nikolai Artemiev.

Light uploaded patch set #6 to this change.

View Change

writeprotect_ranges.c: Check for underflow when using unsigned types

size_t is an unsigned type so bp_max-2 causes an underflow. This results
in undefined behaviour. So assert before that bits->bp_bit-count > 1 so
that bp_max has a minimum value of 2. But the when bp_bit_count == 0
then bp == 0 and when bp_bit_count == 1 then bp == 0 or bp == 1 ==
bp_max. These cases are handled seaprately so the underflow will never
occur. Ignore the tool for this issue.

Change-Id: I2766ef8e34f7121dad746e5f32a835d480ae1cad
Signed-off-by: Aarya Chaumal <aarya.chaumal@gmail.com>
---
M writeprotect_ranges.c
1 file changed, 3 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/33/62733/6

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

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I2766ef8e34f7121dad746e5f32a835d480ae1cad
Gerrit-Change-Number: 62733
Gerrit-PatchSet: 6
Gerrit-Owner: Light <aarya.chaumal@gmail.com>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Nikolai Artemiev <nartemiev@google.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-CC: Angel Pons <th3fanbus@gmail.com>
Gerrit-Attention: Angel Pons <th3fanbus@gmail.com>
Gerrit-Attention: Light <aarya.chaumal@gmail.com>
Gerrit-Attention: Nikolai Artemiev <nartemiev@google.com>
Gerrit-MessageType: newpatchset