Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Aug 2018 20:10:59 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r337170 - head/sys/fs/nfsclient
Message-ID:  <201808022010.w72KAx8h008099@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Thu Aug  2 20:10:59 2018
New Revision: 337170
URL: https://svnweb.freebsd.org/changeset/base/337170

Log:
  Silence newer gcc warnings.
  
  Newer versions of gcc generate "might not be initialized" warnings for
  several variables in nfsrpc_doiods().  I have checked and all of these
  variables are assigned values before they are used.
  In the one case of "tdrpc", it could have passed garbage as an argument
  to nfscl_dofflayoutio() when mirrorcnt is one. However nfscl_dofflayoutio() only
  uses the argument when mirrorcnt > 1, so it wasn't actually broken.
  This patch initializes "tdrpc" to avoid confusion and initializes the rest
  to make the compiler happy.
  
  Requested by:	mmacy

Modified:
  head/sys/fs/nfsclient/nfs_clrpcops.c

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clrpcops.c	Thu Aug  2 20:06:46 2018	(r337169)
+++ head/sys/fs/nfsclient/nfs_clrpcops.c	Thu Aug  2 20:10:59 2018	(r337170)
@@ -5619,10 +5619,10 @@ nfscl_doiods(vnode_t vp, struct uio *uiop, int *iomode
 	int eof, error, firstmirror, i, iolaymode, mirrorcnt, recalled, timo;
 	void *lckp;
 	uint8_t *dev;
-	void *iovbase;
-	size_t iovlen;
-	off_t offs;
-	ssize_t resid;
+	void *iovbase = NULL;
+	size_t iovlen = 0;
+	off_t offs = 0;
+	ssize_t resid = 0;
 
 	if (!NFSHASPNFS(nmp) || nfscl_enablecallb == 0 || nfs_numnfscbd == 0 ||
 	    (np->n_flag & NNOLAYOUT) != 0)
@@ -5696,7 +5696,7 @@ nfscl_doiods(vnode_t vp, struct uio *uiop, int *iomode
 			 * do all mirrors.
 			 */
 			m = NULL;
-			drpc = NULL;
+			tdrpc = drpc = NULL;
 			firstmirror = 0;
 			mirrorcnt = 1;
 			if ((layp->nfsly_flags & NFSLY_FLEXFILE) != 0 &&



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808022010.w72KAx8h008099>