Fix -Wmaybe-uninitialized warning in xdr.c
Adhemerval Zanella
azanella@linux.vnet.ibm.com
Tue Jul 8 18:01:00 GMT 2014
On 08-07-2014 14:59, Siddhesh Poyarekar wrote:
> Hi,
>
> While we're at fixing build warnings, here's one unnecessary warning
> that can be fixed fairly easily. The SIZE variable is never actually
> use uninitialized, but the compiler cannot make that out and thinks
> (correctly) that there is a potential for accessing SIZE without
> initializing it. Make this safe by initializing SIZE to 0.
>
> Tested on x86_64.
>
> Siddhesh
>
> * sunrpc/xdr.c (xdr_string): Initialize SIZE to 0.
>
> diff --git a/sunrpc/xdr.c b/sunrpc/xdr.c
> index b3f96ca..129abd8 100644
> --- a/sunrpc/xdr.c
> +++ b/sunrpc/xdr.c
> @@ -739,7 +739,7 @@ xdr_string (xdrs, cpp, maxsize)
> u_int maxsize;
> {
> char *sp = *cpp; /* sp is the actual string pointer */
> - u_int size;
> + u_int size = 0;
> u_int nodesize;
>
> /*
Seems trivial enough.
More information about the Libc-alpha
mailing list