Re: FW: [error27/smatch] smatch misidentifies uninitialized variable after switch with no default: (Issue #3)
Dan Carpenter <[email protected]> Mon, 10 Jan 2022 15:42:10 +0300
| Newsgroups | org.kernel.vger.smatch |
|---|---|
| Message-ID | <20220110124210.GC1978@kadam> |
Thanks for the bug report. The ideal way to fix this would be to handle it in Smatch core so that if called get_implied_rl(cmd, &rl) then it would return 0-2. Unfortunately, that's quite a bit of work to implement it properly... For now, I'm just going to add a special case in check_uninitialized.c to silence these warnings. If you have a switch(some_enum) and there is no default statement, then mark all the partially initialized variables as fully initialized. regards, dan carpenter