Jacob Garber has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/32054
Change subject: nb/intel/pineview: Correct unsigned integer check in msbpos ......................................................................
nb/intel/pineview: Correct unsigned integer check in msbpos
The check i >= 0 is always true for an unsigned integer, causing msbpos(0) to hang. We correct it to i != 0.
Note this has no material change since the code guards against finding the msb of 0 anyway, but it fixes Coverity CID 1347386.
Signed-off-by: Jacob Garber jgarber1@ualberta.ca Change-Id: Ic5be50846cc545dcd48593e5ed3fd6068a6104cb --- M src/northbridge/intel/pineview/raminit.c 1 file changed, 1 insertion(+), 1 deletion(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/54/32054/1
diff --git a/src/northbridge/intel/pineview/raminit.c b/src/northbridge/intel/pineview/raminit.c index fa5122a..4f9a0b4 100644 --- a/src/northbridge/intel/pineview/raminit.c +++ b/src/northbridge/intel/pineview/raminit.c @@ -336,7 +336,7 @@ static u8 msbpos(u8 val) //Reverse { u8 i; - for (i = 7; (i >= 0) && ((val & (1 << i)) == 0); i--); + for (i = 7; (i != 0) && ((val & (1 << i)) == 0); i--); return i; }