aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2015-08-17 22:16:17 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-08-17 22:16:52 +1000
commit5a55df727c33141c12ef17f3cbefef397c603661 (patch)
tree3b855de30982b05d6429ab1361011a935812e6c6
parentbc4d8e0f9708cb1afedfe4aa72499f16eb30959d (diff)
downloadskiboot-5a55df727c33141c12ef17f3cbefef397c603661.zip
skiboot-5a55df727c33141c12ef17f3cbefef397c603661.tar.gz
skiboot-5a55df727c33141c12ef17f3cbefef397c603661.tar.bz2
libflash: check ffs_part_info return value in ffs_init
Current packaging builds (which specify -O2) fail for me, with: CC libffs.o ../../libflash/libffs.c: In function ffs_init: ../../libflash/libffs.c:149:8: error: start may be used uninitialized in this function [-Werror=maybe-uninitialized] rc = blocklevel_ecc_protect(bl, start, total_size); ^ ../../libflash/libffs.c:149:8: error: total_size may be used uninitialized in this function [-Werror=maybe-uninitialized] ../../libflash/libffs.c:148:7: error: ecc may be used uninitialized in this function [-Werror=maybe-uninitialized] if (ecc) { ^ cc1: all warnings being treated as errors This is because we're not checking for the return value of ffs_part_info, which may return with start/total_size/ecc uninitialised. Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--libflash/libffs.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libflash/libffs.c b/libflash/libffs.c
index 0164071..3010a61 100644
--- a/libflash/libffs.c
+++ b/libflash/libffs.c
@@ -144,7 +144,13 @@ int ffs_init(uint32_t offset, uint32_t max_size, struct blocklevel_device *bl,
uint32_t start, total_size;
bool ecc;
for (i = 0; i < f->hdr.entry_count; i++) {
- ffs_part_info(f, i, NULL, &start, &total_size, NULL, &ecc);
+ rc = ffs_part_info(f, i, NULL, &start, &total_size,
+ NULL, &ecc);
+ if (rc) {
+ FL_ERR("FFS: Failed to read ffs partition %d\n",
+ i);
+ goto out;
+ }
if (ecc) {
rc = blocklevel_ecc_protect(bl, start, total_size);
if (rc) {