open-gpu-kernel-modules icon indicating copy to clipboard operation
open-gpu-kernel-modules copied to clipboard

always clear numPagesAlloc

Open trixirt opened this issue 2 years ago • 6 comments

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]

trixirt avatar May 18 '22 13:05 trixirt