summaryrefslogtreecommitdiffstats
path: root/hw
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2018-08-21 14:27:15 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2018-09-13 15:19:36 +1000
commit0a087154ca4f6759ad1e25c0b3933a9e6caeb456 (patch)
tree5f9a00c9a80c3e7097c9dbfb2b022820e51a82e5 /hw
parentcfecc3960c00ea9a9871c2358d8710c5d2c6539b (diff)
downloadblackbird-skiboot-0a087154ca4f6759ad1e25c0b3933a9e6caeb456.tar.gz
blackbird-skiboot-0a087154ca4f6759ad1e25c0b3933a9e6caeb456.zip
phb4: Handle allocation errors in phb4_eeh_dump_regs()
If the zalloc fails (and it can be a rather large allocation), we will overwite memory at 0 instead of failing. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/phb4.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/phb4.c b/hw/phb4.c
index 01efd14a..fbf54b5b 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -2072,6 +2072,10 @@ static void phb4_eeh_dump_regs(struct phb4 *p)
return;
s = zalloc(sizeof(struct OpalIoPhb4ErrorData));
+ if (!s) {
+ PHBERR(p, "Failed to allocate error info !\n");
+ return;
+ }
phb4_read_phb_status(p, s);
OpenPOWER on IntegriCloud