[Skiboot] [PATCH] Introduce blocklevel_ecc_protect() return value check

Kamalesh Babulal kamalesh at linux.vnet.ibm.com
Fri Jun 26 14:25:49 AEST 2015


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 <kamalesh at linux.vnet.ibm.com>
Reviewed-By: Cyril Bur <cyril.bur at au1.ibm.com>
---
 libflash/libffs.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

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:
-- 
2.1.2



More information about the Skiboot mailing list