]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
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 b70d3370a54b2381dda30dfb7ca37f2cf46cb112..0773d7ce18a95d977a0f281c76b80d56f44d5765 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 b3f96ca4dc2f9a41183a23bbb4c7b5b7f62fb0bc..129abd8f0018afb89d029a919e4cc7bd6a23aac0 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;
 
   /*