From 9ab7636ce6276d222662be431a1e6be96d9d34c0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Harboe?= Date: Wed, 9 Jun 2010 17:12:52 +0200 Subject: [PATCH] flash: add error message if image is too big for flash MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit replaced assert() w/error message if the image is too big. Signed-off-by: Øyvind Harboe --- src/flash/nor/core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/flash/nor/core.c b/src/flash/nor/core.c index 1bd09b444d..429bad6762 100644 --- a/src/flash/nor/core.c +++ b/src/flash/nor/core.c @@ -636,7 +636,11 @@ int flash_write_unlock(struct target *target, struct image *image, LOG_INFO("Padding image section %d with %d bytes", section_last-1, pad_bytes); } - assert (run_address + run_size - 1 <= c->base + c->size - 1); + if (run_address + run_size - 1 > c->base + c->size - 1) + { + LOG_ERROR("The image is too big for the flash"); + return ERROR_FAIL; + } /* If we're applying any sector automagic, then pad this * (maybe-combined) segment to the end of its last sector. -- 2.30.2