[Skiboot] [PATCH v2] Introduce memory allocation return value check

Stewart Smith stewart at linux.vnet.ibm.com
Fri Jul 10 14:22:08 AEST 2015


Kamalesh Babulal <kamalesh at linux.vnet.ibm.com> writes:

> In pci_std_swizzle_irq_map(), check if the memory allocation
> of interrupt-mask returns a valid pointer before using it.
>
> Fixes Coverity defect#97854.
>
> Signed-off-by: Kamalesh Babulal <kamalesh at linux.vnet.ibm.com>
> Cc: Samuel Mendoza-Jonas <sam.mj at au1.ibm.com>
> Cc: Gavin Shan <gwshan at linux.vnet.ibm.com>
> ---
>  core/pci.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/core/pci.c b/core/pci.c
> index 8f8aeeb..1b56d73 100644
> --- a/core/pci.c
> +++ b/core/pci.c
> @@ -1086,6 +1086,10 @@ void pci_std_swizzle_irq_map(struct dt_node *np,
>  	}
>  	map_size = esize * edevcount * 4 * sizeof(uint32_t);
>  	map = p = zalloc(map_size);
> +	if (!map) {
> +		prlog(PR_DEBUG, "Failed to allocate interrupt-map-mask !\n");
> +		return;
> +	}

Thanks, merged as c727151 with change of prerror() rather than PR_DEBUG.



More information about the Skiboot mailing list