Re: [v2] ice: Fix freeing uninitialized pointers
Markus Elfring <[email protected]> Sun, 24 Mar 2024 14:22:31 +0100
| Newsgroups | org.kernel.vger.smatch,org.kernel.vger.kernel-janitors,org.kernel.vger.linux-kernel,org.kernel.vger.netdev,org.osuosl.intel-wired-lan |
|---|---|
| Message-ID | <[email protected]> |
>>> Automatically cleaned up pointers need to be initialized before exiting >>> their scope. In this case, they need to be initialized to NULL before >>> any return statement. >> >> * May we expect that compilers should report that affected variables >> were only declared here instead of appropriately defined >> (despite of attempts for scope-based resource management)? >> > > We disabled GCC's check for uninitialized variables a long time ago > because it had too many false positives. Can further case distinctions (and compilation parameters) become more helpful according to the discussed handling of the attribute “__cleanup” (or “__free”)? >> * Did you extend detection support in the source code analysis tool “Smatch” >> for a questionable implementation detail? > > Yes. Smatch detects this as an uninitialized variable. Does the corresponding warning indicate requirements for scope-based resource management? Regards, Markus