aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorGustavo A. R. Silva <gustavo@embeddedor.com>2019-01-22 14:18:42 -0600
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>2020-03-04 21:46:11 +0100
commit792a402c2840054533ef56279c212ef6da87d811 (patch)
treea8706dac3da5bbdef7445bd5c0e1866cfb7b0c6d /arch
parentarch/mips: change duplicated word in NUMA help text (diff)
downloadlinux-dev-792a402c2840054533ef56279c212ef6da87d811.tar.xz
linux-dev-792a402c2840054533ef56279c212ef6da87d811.zip
MIPS: OCTEON: irq: Fix potential NULL pointer dereference
There is a potential NULL pointer dereference in case kzalloc() fails and returns NULL. Fix this by adding a NULL check on *cd* This bug was detected with the help of Coccinelle. Fixes: 64b139f97c01 ("MIPS: OCTEON: irq: add CIB and other fixes") Cc: stable@vger.kernel.org Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/mips/cavium-octeon/octeon-irq.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index 6bd1e97effdf..6501a842c41a 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -2199,6 +2199,9 @@ static int octeon_irq_cib_map(struct irq_domain *d,
}
cd = kzalloc(sizeof(*cd), GFP_KERNEL);
+ if (!cd)
+ return -ENOMEM;
+
cd->host_data = host_data;
cd->bit = hw;