This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [Patch, MIPS] Fix uninitialized variable in inet/getnetgrent_r.c
- From: Torvald Riegel <triegel at redhat dot com>
- To: sellcey at imgtec dot com
- Cc: Joseph Myers <joseph at codesourcery dot com>, libc-alpha at sourceware dot org
- Date: Wed, 17 Dec 2014 18:36:35 +0100
- Subject: Re: [Patch, MIPS] Fix uninitialized variable in inet/getnetgrent_r.c
- Authentication-results: sourceware.org; auth=none
- References: <9615e42e-4783-4170-8702-042df4ce8d58 at BAMAIL02 dot ba dot imgtec dot org> <alpine dot DEB dot 2 dot 10 dot 1412102131230 dot 26602 at digraph dot polyomino dot org dot uk> <1418319526 dot 2196 dot 150 dot camel at ubuntu-sellcey>
On Thu, 2014-12-11 at 09:38 -0800, Steve Ellcey wrote:
> On Wed, 2014-12-10 at 21:33 +0000, Joseph Myers wrote:
> > On Wed, 10 Dec 2014, Steve Ellcey wrote:
> >
> > > I looked at the code and I don't think we can actually use an uninitialized
> > > fct variable (due to the use of the no_more variable) but the compiler doesn't
> > > seem to be able to figure that out. This fix is to just initialize fct to
> > > NULL.
> >
> > As previously discussed, we don't want to add such initializations to
> > quiet warnings.
> >
> > In this case, it looks like moving the while loop inside the "if (!
> > no_more)" ought to make it obvious to the compiler that fct can't be used
> > uninitialized.
>
> OK, Here is a new patch that puts the while loop inside the if
> statement. That does get rid of the warning. Other then indenting
> changes (and tweaking a comment so it doesn't wrap) that is the only
> change.
>
> Tested on MIPS with no regressions. OK for checkin?
OK.