timestamp_before_wait might be used uninitialized in this function

walter harms wharms at bfs.de
Tue Jan 13 18:21:45 UTC 2009



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 ?

re,
 wh

btw: can unsigned be replaced with unsigned int or whatever is useful here ?


More information about the busybox mailing list