aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2016-11-11 11:33:34 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-11-11 13:32:56 +1100
commit45b65944e4e6131c7716568b16fb95a61619c43e (patch)
tree7f8a54504f4efa4c3f743ba307f02af8227dcf54
parentd1e2f741ff65dbc3a38e697a65ed0e74b1b27ecc (diff)
downloadskiboot-45b65944e4e6131c7716568b16fb95a61619c43e.zip
skiboot-45b65944e4e6131c7716568b16fb95a61619c43e.tar.gz
skiboot-45b65944e4e6131c7716568b16fb95a61619c43e.tar.bz2
libflash/libffs: Fix possible NULL dereference
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--libflash/libffs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/libflash/libffs.c b/libflash/libffs.c
index 549e6d5..96b7c55 100644
--- a/libflash/libffs.c
+++ b/libflash/libffs.c
@@ -307,6 +307,8 @@ int ffs_part_info(struct ffs_handle *ffs, uint32_t part_idx,
if (name) {
n = malloc(PART_NAME_MAX + 1);
+ if (!n)
+ return FLASH_ERR_MALLOC_FAILED;
memset(n, 0, PART_NAME_MAX + 1);
strncpy(n, ent.name, PART_NAME_MAX);
*name = n;