summaryrefslogtreecommitdiff
path: root/fastboot/fastboot.cpp
diff options
context:
space:
mode:
authorConnor O'Brien <connoro@google.com>2017-11-01 17:37:32 -0700
committerConnor O'Brien <connoro@google.com>2017-11-02 12:51:46 -0700
commit6ef5c24b84252bd601b99c31f1de5dafdb91a66e (patch)
treef9e956d66605a4a14c9655f622894e0c5673f55c /fastboot/fastboot.cpp
parentbb3769349de0f4becb8a4fd2ed33ffeaf8d56862 (diff)
fastboot: handle small flash block sizes correctly
Erase block sizes smaller than the ext4 block size may be valid, but can incorrectly result in a stripe width smaller than the stride size. Instead of reporting these sizes as invalid, add a check to enforce that raid_stripe_width >= raid_stride. Bug: 68770797 Test: Hack fb_getvar to report small erase block size, run fastboot -w and confirm it does not print a warning or set stripe_width smaller than stride. Signed-off-by: Connor O'Brien <connoro@google.com> Change-Id: I689ce4bdd5b38bd0952bb6de54785cca39176010
Diffstat (limited to 'fastboot/fastboot.cpp')
-rw-r--r--fastboot/fastboot.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/fastboot/fastboot.cpp b/fastboot/fastboot.cpp
index c3b1bfb2e..222d64fd1 100644
--- a/fastboot/fastboot.cpp
+++ b/fastboot/fastboot.cpp
@@ -1365,9 +1365,8 @@ static unsigned fb_get_flash_block_size(Transport* transport, std::string name)
fprintf(stderr, "Couldn't parse %s '%s'.\n", name.c_str(), sizeString.c_str());
return 0;
}
- if (size < 4096 || (size & (size - 1)) != 0) {
- fprintf(stderr, "Invalid %s %u: must be a power of 2 and at least 4096.\n",
- name.c_str(), size);
+ if ((size & (size - 1)) != 0) {
+ fprintf(stderr, "Invalid %s %u: must be a power of 2.\n", name.c_str(), size);
return 0;
}
return size;