[kbd] [Lint][Bug report] src/openvt.c:386: 'pid' may be used uninitialized
Vladislav Ivanishin <[email protected]> Tue, 11 Jun 2019 21:20:04 +0300
| Newsgroups | dev.linux.lists.kbd |
|---|---|
| Message-ID | <[email protected]> |
Hi,
I've found this bug using a static analyzer (slightly improved GCC).
Consider variable `pid` in function main from src/openvt.c:
src/openvt.c:166: int opt, pid, i;
src/openvt.c:303: if (direct_exec || ((pid = fork()) == 0)) {
src/openvt.c:386: if (pid < 0)
src/openvt.c:393: waitpid(pid, &retval, 0);
If direct_exec is TRUE, then pid doesn't get initialized, but it is used
outside the conditional regardless of that.
--
Vlad