Nikolai Artemiev has uploaded this change for review.
cli_classic.c: Add error messages for invalid --wp-region use
Print warning 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>
---
M cli_classic.c
1 file changed, 27 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/flashrom refs/changes/25/67725/1
diff --git a/cli_classic.c b/cli_classic.c
index e384845..dd8d5e2 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -1113,9 +1113,18 @@
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.