From 8f51ce1b4a0bc5740cbf85653fb64ac34973f4e8 Mon Sep 17 00:00:00 2001 From: Stewart Smith Date: Tue, 4 Jul 2017 11:26:19 +1000 Subject: hw/fsi-master: check zalloc return value If we can't allocate enough memory for each chip struct mfsi, we're not going to go so well during boot, so just assert that we allocated the memory. Found by static analysis Signed-off-by: Stewart Smith --- hw/fsi-master.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hw/fsi-master.c b/hw/fsi-master.c index a13af44..db433aa 100644 --- a/hw/fsi-master.c +++ b/hw/fsi-master.c @@ -1,4 +1,4 @@ -/* Copyright 2013-2014 IBM Corp. +/* Copyright 2013-2017 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -677,6 +677,7 @@ void mfsi_init(void) for_each_chip(chip) { chip->fsi_masters = zalloc(sizeof(struct mfsi) * 3); + assert(chip->fsi_masters); mfsi_add(chip, &chip->fsi_masters[MFSI_cMFSI0], MFSI_cMFSI0); mfsi_add(chip, &chip->fsi_masters[MFSI_hMFSI0], MFSI_hMFSI0); mfsi_add(chip, &chip->fsi_masters[MFSI_cMFSI1], MFSI_cMFSI1); -- cgit v1.1