summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Nematbakhsh <shawnn@chromium.org>2016-01-14 17:00:07 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-01-15 20:12:08 -0800
commitde6ad70607681d6a34893161ae4373bc10a6de8e (patch)
tree672812681ecbe3e265c27fe9fd1844e9d675b16a
parent7cf0b1514bcea41dd11c4fd0ad9865ef824b2c3d (diff)
downloadchrome-ec-stabilize-7834.66.B.tar.gz
vboot_hash: Save stack space when checking image sizestabilize-7834.66.Brelease-R49-7834.B
Use a static buffer rather than 256 bytes of stack when scanning for the end of an image. BUG=chrome-os-partner:49396 TEST=Verify "ectool echash abort; ectool echash start 0xfffffffe 100" doesn't panic on glados. BRANCH=glados Change-Id: Ia864fe77134533bce079dab3b253142b14410ded Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/322283 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
-rw-r--r--common/system.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/common/system.c b/common/system.c
index 64adef88cd..cd86423dc0 100644
--- a/common/system.c
+++ b/common/system.c
@@ -335,10 +335,14 @@ test_mockable enum system_image_copy_t system_get_image_copy(void)
#endif
}
+/*
+ * TODO(crbug.com/577915): Store image used size at build time and simply
+ * read it back.
+ */
int system_get_image_used(enum system_image_copy_t copy)
{
#ifndef CONFIG_MAPPED_STORAGE
- uint8_t buf[SPI_FLASH_MAX_WRITE_SIZE];
+ static uint8_t buf[SPI_FLASH_MAX_WRITE_SIZE];
#endif
int image_offset;
const uint8_t *image;