[Bug 214277] New: uninitialized variable is in dead code branch
https://bugzilla.novell.com/show_bug.cgi?id=214277 Summary: uninitialized variable is in dead code branch Product: openSUSE 10.2 Version: Alpha 5 plus Platform: PowerPC OS/Version: Linux Status: NEW Severity: Normal Priority: P5 - None Component: Development AssignedTo: matz@novell.com ReportedBy: olh@novell.com QAContact: qa@suse.de rpm-4.*/lib/verify.c:142: warning: 'con' is used uninitialized in this function rc == -1; if (selinuxEnabled == 1 && (flags & RPMVERIFY_CONTEXTS)) { security_context_t con; rc = lgetfilecon(fn, &con); if (rc == -1) *res |= (RPMVERIFY_LGETFILECONFAIL|RPMVERIFY_CONTEXTS); else { rpmsx sx = rpmtsREContext(ts); const char * fcontext; if (sx != NULL) { /* Get file security context from patterns. */ fcontext = rpmsxFContext(sx, fn, fmode); sx = rpmsxFree(sx); } else { /* Get file security context from package. */ fcontext = rpmfiFContext(fi); } if (fcontext == NULL || strcmp(fcontext, con)) *res |= RPMVERIFY_CONTEXTS; freecon(con); } } -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=214277 ------- Comment #1 from olh@novell.com 2006-10-22 11:04 MST ------- Created an attachment (id=102226) --> (https://bugzilla.novell.com/attachment.cgi?id=102226&action=view) verify.i.bz2 -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=214277 matz@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|Normal |Enhancement Status|NEW |ASSIGNED ------- Comment #2 from matz@novell.com 2006-10-23 06:04 MST ------- Hmm, this warning indeed should ideally use the lesser form "may be used uninitialized". But the way this warning is implemented that's currently not easily possible (because it's not control dependend in the way you would need here). It's also questionable if we would want that. In more complex code the deadness of a branch might not be provable as easy as here, and the question is, where to draw the line. So, only an enhancement request, which might better be reported upstream. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=214277 ------- Comment #3 from rguenther@novell.com 2007-01-19 05:10 MST ------- No, the problem is that we don't treat rc = lgetfilecon(fn, &con); as initialization. In fact, we ignore it entirely because we cannot distinguish between an initialization and an (uninitialized) use for such construct. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=214277 ------- Comment #4 from matz@novell.com 2007-01-19 05:25 MST ------- Yes, I know. But as written in the initial report rc is == -1, so the only use of 'con' is in a dead branch. For this code under these circumstances it doesn't matter if we handle '&con' as initializing or not, the only use would be dead anyway. That's what I was referring to when I said the warning is not control dependend. I.e. the interesting thing here is not the call with the reference parameter. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=214277 Olaf Hering <olh@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Found By|Other |Development -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com