Message ID | 20180821042715.23587-2-benh@kernel.crashing.org |
---|---|
State | Accepted |
Headers | show |
Series | None | expand |
diff --git a/hw/phb4.c b/hw/phb4.c index 8b8668cf..41c3e9cc 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);
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> --- hw/phb4.c | 4 ++++ 1 file changed, 4 insertions(+)