diff options
Diffstat (limited to 'util/ec_flash.c')
-rw-r--r-- | util/ec_flash.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/util/ec_flash.c b/util/ec_flash.c index 0ae32403d4..3bae077200 100644 --- a/util/ec_flash.c +++ b/util/ec_flash.c @@ -153,6 +153,13 @@ int ec_flash_write(const uint8_t *buf, int offset, int size) if (write_size < 0) return write_size; + /* + * shouldn't ever happen, but report an error rather than a division + * by zero in the next statement. + */ + if (write_size == 0) + return -1; + step = (pdata_max_size / write_size) * write_size; if (!step) { |