Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/33403
Change subject: nb/intel/nehalem: Die if no memory ranks found ......................................................................
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 jgarber1@ualberta.ca Found-by: Coverity CID 1229628 --- M src/northbridge/intel/nehalem/raminit.c 1 file changed, 3 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/33403/1
diff --git a/src/northbridge/intel/nehalem/raminit.c b/src/northbridge/intel/nehalem/raminit.c index 15d6abb..03831e2 100644 --- a/src/northbridge/intel/nehalem/raminit.c +++ b/src/northbridge/intel/nehalem/raminit.c @@ -1010,6 +1010,9 @@ } }
+ if (count == 0) + die("No memory ranks found for channel %u\n", channel); + info->avg4044[channel] = sum / count; info->max4048[channel] = max_of_unk; }