aboutsummaryrefslogtreecommitdiff
path: root/cmd/sf.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/sf.c')
-rw-r--r--cmd/sf.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd/sf.c b/cmd/sf.c
index 11b9c25..55bef2f 100644
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -353,6 +353,11 @@ static int do_spi_flash_erase(int argc, char *const argv[])
if (ret != 1)
return CMD_RET_USAGE;
+ if (size == 0) {
+ debug("ERROR: Invalid size 0\n");
+ return CMD_RET_FAILURE;
+ }
+
/* Consistency checking */
if (offset + size > flash->size) {
printf("ERROR: attempting %s past flash size (%#x)\n",