open-gpu-kernel-modules
open-gpu-kernel-modules copied to clipboard
always clear numPagesAlloc
Clang static analysis on RHEL reports this issue addrtree.c:1154:50: warning: The left operand of '/' is a garbage value [core.UndefinedBinaryOperatorResult] *numPagesAlloc += localNumPagesAlloc / 2; ~~~~~~~~~~~~~~~~~~ ^
_pmaAddrtreeScanContiguous() can return early with an error without setting numPagesAlloc. There are several uses of _pmaAddrtreeScanCantiguous() that do not check the status and depend on the setting of of numPageAlloc as a side effect.
To ensure the side effect is always valid, move the clearing of numPagesAlloc to before the early exit
Signed-off-by: Tom Rix [email protected]