From de6ad70607681d6a34893161ae4373bc10a6de8e Mon Sep 17 00:00:00 2001 From: Shawn Nematbakhsh Date: Thu, 14 Jan 2016 17:00:07 -0800 Subject: vboot_hash: Save stack space when checking image size 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 Reviewed-on: https://chromium-review.googlesource.com/322283 Commit-Ready: Shawn N Tested-by: Shawn N Reviewed-by: Duncan Laurie --- common/system.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; -- cgit v1.2.1