summaryrefslogtreecommitdiffstats
path: root/libflash
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2016-01-12 16:15:39 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-01-12 16:51:01 +1100
commit1663987dd18a71204fb2ac6a1737e2dadab33f99 (patch)
tree8840b9cb1823a46b77b8e9a862dc8a62dbd4c1f3 /libflash
parentb7168570fc7e1a04421a3082f841fa43742ce7fd (diff)
downloadblackbird-skiboot-1663987dd18a71204fb2ac6a1737e2dadab33f99.tar.gz
blackbird-skiboot-1663987dd18a71204fb2ac6a1737e2dadab33f99.zip
libflash/libffs: Check for NULL and set return pointer in ffs_next_side()
Currently there are two error cases that ffs_next_side() may hit and will leave the return pointer untouched. This isn't a huge problem as the caller should be checking the return value anyway but as we know, callers don't always do that. It doesn't hurt for ffs_next_side() to make it as clear as possible that it encountered a problem. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Reviewed-by: Sam Mendoza-Jonas <sam@mendozajonas.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'libflash')
-rw-r--r--libflash/libffs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libflash/libffs.c b/libflash/libffs.c
index cc534e23..51d98562 100644
--- a/libflash/libffs.c
+++ b/libflash/libffs.c
@@ -294,6 +294,12 @@ int ffs_next_side(struct ffs_handle *ffs, struct ffs_handle **new_ffs,
{
int rc;
uint32_t index, offset, max_size;
+
+ if (!ffs || !new_ffs)
+ return FLASH_ERR_PARM_ERROR;
+
+ *new_ffs = NULL;
+
rc = ffs_lookup_part(ffs, "OTHER_SIDE", &index);
if (rc)
return rc;
OpenPOWER on IntegriCloud