diff options
author | Vasant Hegde <hegdevasant@linux.vnet.ibm.com> | 2019-04-09 17:21:24 +0530 |
---|---|---|
committer | Stewart Smith <stewart@linux.ibm.com> | 2019-04-17 15:56:34 +1000 |
commit | e0b8541ff8ca6f63c0a8bd65308a6e1c01d4e4ac (patch) | |
tree | fa6518441902600c6c72a1be67f9e5f9ebf4d8a7 /external/opal-prd/opal-prd.c | |
parent | a7855bdd659382468ffc17ad6460c4c67488c2e6 (diff) | |
download | skiboot-e0b8541ff8ca6f63c0a8bd65308a6e1c01d4e4ac.zip skiboot-e0b8541ff8ca6f63c0a8bd65308a6e1c01d4e4ac.tar.gz skiboot-e0b8541ff8ca6f63c0a8bd65308a6e1c01d4e4ac.tar.bz2 |
opal-prd: Check malloc return value
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'external/opal-prd/opal-prd.c')
-rw-r--r-- | external/opal-prd/opal-prd.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/external/opal-prd/opal-prd.c b/external/opal-prd/opal-prd.c index 1452a17..41d13ec 100644 --- a/external/opal-prd/opal-prd.c +++ b/external/opal-prd/opal-prd.c @@ -1017,6 +1017,10 @@ static int open_and_read(const char *path, void **bufp, int *lenp) } buf = malloc(statbuf.st_size); + if (!buf) { + close(fd); + return -1; + } for (rc = bytes = 0; bytes < statbuf.st_size; bytes += rc) { rc = read(fd, buf + bytes, statbuf.st_size - bytes); |