From patchwork Tue Jul 8 17:59:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Siddhesh Poyarekar X-Patchwork-Id: 1953 Received: (qmail 18792 invoked by alias); 8 Jul 2014 17:59:31 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 18652 invoked by uid 89); 8 Jul 2014 17:59:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.8 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Date: Tue, 8 Jul 2014 23:29:19 +0530 From: Siddhesh Poyarekar To: libc-alpha@sourceware.org Subject: Fix -Wmaybe-uninitialized warning in xdr.c Message-ID: <20140708175919.GL609@spoyarek.pnq.redhat.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.22.1-rc1 (2013-10-16) 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; /*