1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-26 22:52:34 +02:00

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>
This commit is contained in:
Nikolai Artemiev 2022-09-20 15:45:34 +10:00 committed by Felix Singer
parent ad0ee5c606
commit 7e8d17a8bd

View File

@ -1110,9 +1110,17 @@ int main(int argc, char *argv[])
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(