summaryrefslogtreecommitdiffstats
path: root/hw/fsp
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2016-07-02 20:17:06 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-07-11 13:39:42 +1000
commit58269b7eb9c0c7b725bbffe4836b3ff0b4f07926 (patch)
treea00baa88299b48e77c736e3905f2c89c93f22295 /hw/fsp
parentd6767a5ffa139abb70af8dce7baae7be9bc89817 (diff)
downloadblackbird-skiboot-58269b7eb9c0c7b725bbffe4836b3ff0b4f07926.tar.gz
blackbird-skiboot-58269b7eb9c0c7b725bbffe4836b3ff0b4f07926.zip
FSP: Validate fsp_msg response memory allocation
fsp_allocmsg() returns true even if msg->resp memory allocation fails. Validate msg->resp memory allocation as well. Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Reviewed-by: Mukesh Ojha <mukesh02@linux.vnet.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw/fsp')
-rw-r--r--hw/fsp/fsp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/hw/fsp/fsp.c b/hw/fsp/fsp.c
index 888da88d..26cad638 100644
--- a/hw/fsp/fsp.c
+++ b/hw/fsp/fsp.c
@@ -249,8 +249,14 @@ struct fsp_msg *fsp_allocmsg(bool alloc_response)
msg = __fsp_allocmsg();
if (!msg)
return NULL;
- if (alloc_response)
+ if (alloc_response) {
msg->resp = __fsp_allocmsg();
+ if (!msg->resp) {
+ free(msg);
+ return NULL;
+ }
+ }
+
return msg;
}
OpenPOWER on IntegriCloud