From 4a0dbcd9848f4672b3bd10f010615f263f34699b Mon Sep 17 00:00:00 2001 From: Kamalesh Babulal Date: Fri, 26 Jun 2015 09:55:49 +0530 Subject: Introduce blocklevel_ecc_protect() return value check Check for the return value from blocklevel_ecc_protect(), while registering regions of the flash and log error incase the return registration of region fails. Fixes Coverity defect#101019 Signed-off-by: Kamalesh Babulal Reviewed-By: Cyril Bur Signed-off-by: Stewart Smith --- libflash/libffs.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'libflash/libffs.c') diff --git a/libflash/libffs.c b/libflash/libffs.c index f4aafd8..0164071 100644 --- a/libflash/libffs.c +++ b/libflash/libffs.c @@ -145,9 +145,15 @@ int ffs_init(uint32_t offset, uint32_t max_size, struct blocklevel_device *bl, bool ecc; for (i = 0; i < f->hdr.entry_count; i++) { ffs_part_info(f, i, NULL, &start, &total_size, NULL, &ecc); - if (ecc) - blocklevel_ecc_protect(bl, start, total_size); - } + if (ecc) { + rc = blocklevel_ecc_protect(bl, start, total_size); + if (rc) { + FL_ERR("Failed to blocklevel_ecc_protect(0x%08x, 0x%08x)\n", + start, total_size); + goto out; + } + } /* ecc */ + } /* for */ } out: -- cgit v1.1