aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2018-08-21 14:27:15 +1000
committerStewart Smith <stewart@linux.ibm.com>2018-09-13 18:32:18 +1000
commita20833de7e2fa9a044862cbdeb48a564544a84ed (patch)
treee99986169059ce521cd3e552dd4fcdf76fb1329d
parentecd2b6cd20a0fb5600fc5dfb20383d57e9c2f24e (diff)
downloadskiboot-a20833de7e2fa9a044862cbdeb48a564544a84ed.zip
skiboot-a20833de7e2fa9a044862cbdeb48a564544a84ed.tar.gz
skiboot-a20833de7e2fa9a044862cbdeb48a564544a84ed.tar.bz2
phb4: Handle allocation errors in phb4_eeh_dump_regs()
[ Upstream commit 0a087154ca4f6759ad1e25c0b3933a9e6caeb456 ] 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> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
-rw-r--r--hw/phb4.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/phb4.c b/hw/phb4.c
index 3a4cc85..d0ab99a 100644
--- a/hw/phb4.c
+++ b/hw/phb4.c
@@ -1943,6 +1943,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);