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 &&
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to