Re: [PATCH 2/2] read-cache: fix an -Wmaybe-uninitialized warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 20, 2018 at 10:52:16PM +0000, Ramsay Jones wrote:

> > Maybe too clever, but I think you could just do:
> > 
> >   unsigned int saved_namelen = 0;
> >   ...
> > 	saved_namelen = ce_namelen(ce);
> >   ...
> >   if (saved_namelen)
> > 	ce->ce_namelen = saved_namelen;
> >   ce->ce_flags &= ~CE_STRIP_NAME;
> > 
> > the zero-length name case (if that's even legal) would work out the
> > same.
> 
> Yeah, that was one option that I looked at. The first option
> was to initialise saved_namelen to -1 (it was still an int) then
> the test became if (saved_namelen >= 0). However, that started
> me thinking about the zero-length case - should I assert if
> ((ce->ce_flags & CE_STRIP_NAME) && (ce_namelen(ce) == 0))? etc.
> 
> In the end, I decided that I wanted it to be 'drop dead' obvious
> what was going on! Hopefully, the result was just that. :-D

Yeah, thinking on it more, simple and stupid is the right thing to do
here. Thanks for a dose of sanity. :)

-Peff



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux