ui/devcmd: make sure the 'total size' argument for the 'erase' command makes sense

This commit is contained in:
Triss 2022-07-24 02:18:29 +02:00
parent f1d416944c
commit 39a44095eb
1 changed files with 6 additions and 0 deletions

View File

@ -207,6 +207,12 @@ int cmd_erase(char **arg)
"0x%x\n", segment_size); "0x%x\n", segment_size);
return -1; return -1;
} }
if (total_size % segment_size != 0) {
printc_err("erase: total size must be a multiple of the "
"segment size!\n");
return -1;
}
} else { } else {
printc_err("erase: unknown erase type: %s\n", printc_err("erase: unknown erase type: %s\n",
type_text); type_text);