From 64fb4a32e0b7e51f25f530d232fefc14c7523def Mon Sep 17 00:00:00 2001 From: Jacob Garber Date: Mon, 10 Jun 2019 17:29:18 -0600 Subject: nb/intel/nehalem: Die if no memory ranks found Die if there are no memory ranks found to prevent a division by zero. Change-Id: I6146dd8420f3734d1a672a9f29a098f47fcb739c Signed-off-by: Jacob Garber Found-by: Coverity CID 1229628 Reviewed-on: https://review.coreboot.org/c/coreboot/+/33403 Tested-by: build bot (Jenkins) Reviewed-by: HAOUAS Elyes Reviewed-by: Nico Huber Reviewed-by: Angel Pons --- src/northbridge/intel/nehalem/raminit.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/northbridge/intel/nehalem/raminit.c') diff --git a/src/northbridge/intel/nehalem/raminit.c b/src/northbridge/intel/nehalem/raminit.c index 2b71c81825..0b5f44c73f 100644 --- a/src/northbridge/intel/nehalem/raminit.c +++ b/src/northbridge/intel/nehalem/raminit.c @@ -1010,6 +1010,9 @@ static void compute_derived_timings(struct raminfo *info) } } + if (count == 0) + die("No memory ranks found for channel %u\n", channel); + info->avg4044[channel] = sum / count; info->max4048[channel] = max_of_unk; } -- cgit v1.2.3