diff options
author | Kamalesh Babulal <kamalesh@linux.vnet.ibm.com> | 2015-06-26 09:55:49 +0530 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2015-07-10 13:52:11 +1000 |
commit | 4a0dbcd9848f4672b3bd10f010615f263f34699b (patch) | |
tree | 3b38e627668d3673398ddfd79d6f8d1bd1a258dc | |
parent | d407147de08d5ec90d97045c221c6cb38e69e9e4 (diff) | |
download | skiboot-4a0dbcd9848f4672b3bd10f010615f263f34699b.zip skiboot-4a0dbcd9848f4672b3bd10f010615f263f34699b.tar.gz skiboot-4a0dbcd9848f4672b3bd10f010615f263f34699b.tar.bz2 |
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 <kamalesh@linux.vnet.ibm.com>
Reviewed-By: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | libflash/libffs.c | 12 |
1 files 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: |