codeql icon indicating copy to clipboard operation
codeql copied to clipboard

CodeQL - false positive: Potentially uninitialized local variable after noreturn function.

Open andyhhp opened this issue 3 years ago • 0 comments

I'm transitioning a project from LGTM.com to Github Actions CodeQL.

While doing so, https://github.com/TrenchBoot/secure-kernel-loader/security/code-scanning/18 got reported.

The complaint is a "Potentially uninitialized local variable" and while strictly speaking, this statement is true, the alert is wrong.

In this specific example, all paths leading to this point where the variable isn't suitably initialised end up making a call to reboot() which is __attribute__((noreturn)). In fact, it's a local static function, which also ends with __builtin_unreachable() for extra measure.

Shouldn't these annotations have caused the analysis to realise that the variable is properly initialised?

andyhhp avatar Sep 28 '22 00:09 andyhhp