Edward O'Callaghan has uploaded this change for review. ( https://review.coreboot.org/c/flashrom/+/61582 )
Change subject: cli_classic.: Use flashrom_init() from API
......................................................................
cli_classic.: Use flashrom_init() from API
flashrom_init() already does delay calibration and self-checking
via the canonical libflashrom API. Port the cli implementation
to go via the libflashrom API entry-point natively.
BUG=none
TEST=`make`
Change-Id: I07faeed876f678c35355621a080c7852eed16824
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
---
M cli_classic.c
1 file changed, 2 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/82/61582/1
diff --git a/cli_classic.c b/cli_classic.c
index 8c337eb..fe1eeea 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -350,7 +350,8 @@
print_version();
print_banner();
- if (selfcheck())
+ /* FIXME: Delay calibration should happen in programmer code. */
+ if (flashrom_init(1))
exit(1);
setbuf(stdout, NULL);
@@ -661,9 +662,6 @@
}
}
- /* FIXME: Delay calibration should happen in programmer code. */
- myusec_calibrate_delay();
-
if (programmer_init(prog, pparam)) {
msg_perr("Error: Programmer initialization failed.\n");
ret = 1;
--
To view, visit https://review.coreboot.org/c/flashrom/+/61582
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I07faeed876f678c35355621a080c7852eed16824
Gerrit-Change-Number: 61582
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-MessageType: newchange
Attention is currently required from: Edward O'Callaghan, Angel Pons.
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/61545 )
Change subject: fmap.c: Avoid undefined behaviour with fmap_lsearch([len:=0])
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://review.coreboot.org/c/flashrom/+/61545
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ifb408c55c3b69ddff453dcc704b7389298050473
Gerrit-Change-Number: 61545
Gerrit-PatchSet: 2
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Thu, 03 Feb 2022 01:09:52 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Edward O'Callaghan, Angel Pons.
Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/61545 )
Change subject: fmap.c: Avoid undefined behaviour with fmap_lsearch([len:=0])
......................................................................
Patch Set 2: Code-Review+2
--
To view, visit https://review.coreboot.org/c/flashrom/+/61545
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ifb408c55c3b69ddff453dcc704b7389298050473
Gerrit-Change-Number: 61545
Gerrit-PatchSet: 2
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Comment-Date: Wed, 02 Feb 2022 23:48:53 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: Nico Huber, Angel Pons, Julius Werner.
Edward O'Callaghan has posted comments on this change. ( https://review.coreboot.org/c/flashrom/+/61545 )
Change subject: fmap.c: Avoid undefined behaviour with fmap_lsearch([len:=0])
......................................................................
Patch Set 1:
(2 comments)
File fmap.c:
https://review.coreboot.org/c/flashrom/+/61545/comment/cb96c3e4_1f726393
PS1, Line 99: if (len == 0)
> +1 we should simply check that the calculation below doesn't overflow.
sure, the predicate is more precisely:
`if ((len < sizeof(struct fmap)) return -1;`
https://review.coreboot.org/c/flashrom/+/61545/comment/53e5ad73_ba69f67e
PS1, Line 102: (off_t)(len - sizeof(struct fmap)
> Hrmm, I added this cast at some point, but it doesn't seem to fix the […]
That is right. Rather than fixing via type coercion's, a more explicit function parameter validation in the preamble seems sensible. It's not like C's type-system is so rich to allow for bounding the functions domain rigorously imho.
--
To view, visit https://review.coreboot.org/c/flashrom/+/61545
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ifb408c55c3b69ddff453dcc704b7389298050473
Gerrit-Change-Number: 61545
Gerrit-PatchSet: 1
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Nico Huber <nico.h(a)gmx.de>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Julius Werner <jwerner(a)chromium.org>
Gerrit-Comment-Date: Wed, 02 Feb 2022 23:45:16 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Nico Huber <nico.h(a)gmx.de>
Comment-In-Reply-To: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-MessageType: comment
Attention is currently required from: Edward O'Callaghan, Angel Pons, Julius Werner.
Hello build bot (Jenkins), Nico Huber, Julius Werner, Angel Pons,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/flashrom/+/61545
to look at the new patch set (#2).
Change subject: fmap.c: Avoid undefined behaviour with fmap_lsearch([len:=0])
......................................................................
fmap.c: Avoid undefined behaviour with fmap_lsearch([len:=0])
Calling libflashrom entry-points that internally dispatch to
fmap_lsearch() can result in a integer overflow. Therefore
validate the length paramter before attempting to use it.
BUG=none
TEST=`make`
Change-Id: Ifb408c55c3b69ddff453dcc704b7389298050473
Signed-off-by: Edward O'Callaghan <quasisec(a)google.com>
Spotted-by: Julius Werner <jwerner(a)chromium.org>
---
M fmap.c
1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/45/61545/2
--
To view, visit https://review.coreboot.org/c/flashrom/+/61545
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ifb408c55c3b69ddff453dcc704b7389298050473
Gerrit-Change-Number: 61545
Gerrit-PatchSet: 2
Gerrit-Owner: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Reviewer: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Reviewer: Julius Werner <jwerner(a)chromium.org>
Gerrit-Reviewer: Nico Huber <nico.h(a)gmx.de>
Gerrit-Reviewer: build bot (Jenkins) <no-reply(a)coreboot.org>
Gerrit-Attention: Edward O'Callaghan <quasisec(a)chromium.org>
Gerrit-Attention: Angel Pons <th3fanbus(a)gmail.com>
Gerrit-Attention: Julius Werner <jwerner(a)chromium.org>
Gerrit-MessageType: newpatchset