timestamp_before_wait might be used uninitialized in this function
Denys Vlasenko
vda.linux at googlemail.com
Wed Jan 14 01:52:22 UTC 2009
On Tuesday 13 January 2009 19:21, walter harms wrote:
> Cristian Ionescu-Idbohrn schrieb:
> > I see this warning, and I don't like it:
> >
> > busybox-1.13.2/networking/udhcp/dhcpc.c:
> > In function `udhcpc_main':
> > busybox-1.13.2/networking/udhcp/dhcpc.c:321:
> > warning: `timestamp_before_wait' might be used uninitialized in this function
> >
> > Is this patch appropriate?
> >
> > --- busybox-1.13.2/networking/udhcp/dhcpc.c.~1~ 2008-11-09 18:27:58.000000000 +0100
> > +++ busybox-1.13.2/networking/udhcp/dhcpc.c 2009-01-13 13:09:30.000000000 +0100
> > @@ -342,7 +342,8 @@
> > /* Else: an error occured, panic! */
> > bb_perror_msg_and_die("select");
> > }
> > - }
> > + } else
> > + timestamp_before_wait = 0;
> >
> > /* If timeout dropped to zero, time to become active:
> > * resend discover/renew/whatever
> >
> >
> > Cheers,
> >
>
> maybe a simple
> unsigned timestamp_before_wait=0;
>
> will do the same ?
Yes. but
unsigned timestamp_before_wait = timestamp_before_wait;
is better wrt code size. :)
fixed. thanks.
> btw: can unsigned be replaced with unsigned int or whatever is useful here ?
?! "unsigned" and "unsigned int" are the same.
--
vda
More information about the busybox
mailing list