[Skiboot] [PATCH] FSP: Validate fsp_msg response memory allocation
Mukesh Ojha
mukesh02 at linux.vnet.ibm.com
Mon Jul 4 16:36:55 AEST 2016
Hi Vasant,
Looks good.
Reviewed-by: Mukesh Ojha <mukesh02 at linux.vnet.ibm.com>
On Saturday 02 July 2016 08:17 PM, Vasant Hegde wrote:
> fsp_allocmsg() returns true even if msg->resp memory allocation fails.
> Validate msg->resp memory allocation as well.
>
> Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
> ---
> hw/fsp/fsp.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/hw/fsp/fsp.c b/hw/fsp/fsp.c
> index 888da88..26cad63 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);
free(NULL);
This is redundant.
-Mukesh
> + return NULL;
> + }
> + }
> +
> return msg;
> }
>
>
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
More information about the Skiboot
mailing list