This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix -Wmaybe-uninitialized warning in xdr.c


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;
 
   /*

Attachment: pgpHbQ3osb0Sv.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]