aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorKamalesh Babulal <kamalesh@linux.vnet.ibm.com>2015-06-24 11:41:24 +0530
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-07-10 14:21:03 +1000
commitc7271519d4e893a72ebe1a70d9f9f8983a63aa7a (patch)
treeb57fad38b3a39ca6456bdd01c9b64f044c0f7dd5 /core
parentb2f4e01029d9919dedecfe445576061fe4653f9e (diff)
downloadskiboot-c7271519d4e893a72ebe1a70d9f9f8983a63aa7a.zip
skiboot-c7271519d4e893a72ebe1a70d9f9f8983a63aa7a.tar.gz
skiboot-c7271519d4e893a72ebe1a70d9f9f8983a63aa7a.tar.bz2
Introduce memory allocation return value check
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@linux.vnet.ibm.com> Cc: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> Cc: Gavin Shan <gwshan@linux.vnet.ibm.com> [stewart@linux.vnet.ibm.com: change to prerror() rather than prlog(DEBUG)] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'core')
-rw-r--r--core/pci.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/pci.c b/core/pci.c
index 7083ea1..2d5906a 100644
--- a/core/pci.c
+++ b/core/pci.c
@@ -1087,6 +1087,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) {
+ prerror("Failed to allocate interrupt-map-mask !\n");
+ return;
+ }
for (dev = 0; dev < edevcount; dev++) {
for (irq = 0; irq < 4; irq++) {