Fix -Wmaybe-uninitialized warning in xdr.c
authorSiddhesh Poyarekar <siddhesh@redhat.com>
Wed, 9 Jul 2014 05:06:50 +0000 (10:36 +0530)
committerSiddhesh Poyarekar <siddhesh@redhat.com>
Wed, 9 Jul 2014 05:06:50 +0000 (10:36 +0530)
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.

ChangeLog
sunrpc/xdr.c

index b70d337..0773d7c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2014-07-09  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
+       * sunrpc/xdr.c (xdr_string): Initialize SIZE to 0.
+
        * sysdeps/generic/unwind-pe.h: Only check if __cplusplus is
        defined.
 
index b3f96ca..129abd8 100644 (file)
@@ -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;
 
   /*