Attention is currently required from: Edward O'Callaghan, Angel Pons, Anastasia Klimchuk, Nikolai Artemiev, Sergii Dmytruk.
View Change
2 comments:
File writeprotect.c:
Patch Set #10, Line 271: ranges[++last] = ranges[i];
I don't understand how it works :(( this assignment... […]
In the first iteration (last == 0, i == 0), it would compare the same
element, hence `duplicate` would be `true` and this line would be skipped.
In further iterations, `last` would at least be one less than `i`, hence
it would potentially overwrite duplicates (at `last + 1`) with later elements
at `i`.
It's hard to read, indeed. Starting the loop at `i == 1` might make things
easier.
And there is at least one (theoretical?) case where the code fails, see
below.
Patch Set #10, Line 274: *count = last + 1;
If `*count` was 0 initially, i.e. an empty list, this would set it to `1`.
To view, visit change 58481. To unsubscribe, or for help writing mail filters, visit settings.
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Id51f038f03305c8536d80313e52f77d27835f34d
Gerrit-Change-Number: 58481
Gerrit-PatchSet: 10
Gerrit-Owner: Nikolai Artemiev <nartemiev@google.com>
Gerrit-Reviewer: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-Attention: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus@gmail.com>
Gerrit-Attention: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-Attention: Nikolai Artemiev <nartemiev@google.com>
Gerrit-Attention: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Gerrit-Comment-Date: Tue, 16 Nov 2021 15:08:23 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Anastasia Klimchuk <aklm@chromium.org>
Gerrit-MessageType: comment