summaryrefslogtreecommitdiff
path: root/src/soc
diff options
context:
space:
mode:
authorJacob Garber <jgarber1@ualberta.ca>2019-03-25 18:20:06 -0600
committerPatrick Georgi <pgeorgi@google.com>2019-04-08 14:15:20 +0000
commitb70c77691ba9a26989fc8922a2e1807f6f8bdd09 (patch)
treede19d4080cc794835ea349874c9d84c690c6166a /src/soc
parent0decccb666245e38bfd0595e8c7e312c6937c465 (diff)
nb/intel/pineview: Correct lsbpos(0) and msbpos(0)
lsbpos and msbpos have incorrect behaviour when given 0. lsbpos(0) returns 8, and msbpos(0) hangs. The latter is because the check i >= 0 is always true for an unsigned integer, causing it to loop indefinitely (this was flagged by Coverity). 0 doesn't have a lsb or msb position, so we change both functions to return -1 in this case to indicate an error. The code already guards against calling these functions with 0, but we make this more explicit to prevent errors in the future. Found-by: Coverity Scan, CID 1347356, 1347386 Signed-off-by: Jacob Garber <jgarber1@ualberta.ca> Change-Id: Ic5be50846cc545dcd48593e5ed3fd6068a6104cb Reviewed-on: https://review.coreboot.org/c/coreboot/+/32054 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/soc')
0 files changed, 0 insertions, 0 deletions