Felix Singer submitted this change.

View Change



6 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.

Approvals: build bot (Jenkins): Verified Felix Singer: Looks good to me, approved
cli_classic.c: Add error messages for invalid --wp-region use

Print errors if --wp-region is used without a layout file or the layout
file doesn't contain the region.

BUG=b:247055486
TEST=builds

Change-Id: Ie606ba7f8a423405099679ca62169c395d994b5d
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67725
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Singer <felixsinger@posteo.net>
---
M cli_classic.c
1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/cli_classic.c b/cli_classic.c
index bac31d1..3de0020 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -1110,9 +1110,17 @@

if (any_wp_op) {
if (set_wp_region && wp_region) {
- ret = flashrom_layout_get_region_range(layout, wp_region, &wp_start, &wp_len);
- if (ret)
+ if (!layout) {
+ msg_gerr("Error: A flash layout must be specified to use --wp-region.\n");
+ ret = 1;
goto out_release;
+ }
+
+ ret = flashrom_layout_get_region_range(layout, wp_region, &wp_start, &wp_len);
+ if (ret) {
+ msg_gerr("Error: Region %s not found in flash layout.\n", wp_region);
+ goto out_release;
+ }
set_wp_range = true;
}
ret = wp_cli(

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

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: Ie606ba7f8a423405099679ca62169c395d994b5d
Gerrit-Change-Number: 67725
Gerrit-PatchSet: 8
Gerrit-Owner: Nikolai Artemiev <nartemiev@google.com>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Edward O'Callaghan <quasisec@chromium.org>
Gerrit-Reviewer: Felix Singer <felixsinger@posteo.net>
Gerrit-Reviewer: build bot (Jenkins) <no-reply@coreboot.org>
Gerrit-MessageType: merged