Coverity CID 2510-2514: Always initialize cache.

This commit is contained in:
christos 2006-04-15 00:44:18 +00:00
parent 4c9d749d77
commit ff33272e7b

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_serv.c,v 1.102 2006/03/27 20:20:46 martin Exp $ */
/* $NetBSD: nfs_serv.c,v 1.103 2006/04/15 00:44:18 christos Exp $ */
/*
* Copyright (c) 1989, 1993
@ -55,7 +55,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.102 2006/03/27 20:20:46 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.103 2006/04/15 00:44:18 christos Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -182,7 +182,7 @@ nfsrv_getattr(nfsd, slp, lwp, mrq)
u_int32_t *tl;
int32_t t1;
caddr_t bpos;
int error = 0, rdonly, cache;
int error = 0, rdonly, cache = 0;
char *cp2;
struct mbuf *mb, *mreq;
u_quad_t frev;
@ -229,7 +229,7 @@ nfsrv_setattr(nfsd, slp, lwp, mrq)
u_int32_t *tl;
int32_t t1;
caddr_t bpos;
int error = 0, rdonly, cache, preat_ret = 1, postat_ret = 1;
int error = 0, rdonly, cache = 0, preat_ret = 1, postat_ret = 1;
int v3 = (nfsd->nd_flag & ND_NFSV3), gcheck = 0;
char *cp2;
struct mbuf *mb, *mreq;
@ -367,7 +367,7 @@ nfsrv_lookup(nfsd, slp, lwp, mrq)
u_int32_t *tl;
int32_t t1;
caddr_t bpos;
int error = 0, cache, dirattr_ret = 1;
int error = 0, cache = 0, dirattr_ret = 1;
uint32_t len;
int v3 = (nfsd->nd_flag & ND_NFSV3), pubflag;
char *cp2;
@ -486,7 +486,7 @@ nfsrv_readlink(nfsd, slp, lwp, mrq)
u_int32_t *tl;
int32_t t1;
caddr_t bpos;
int error = 0, rdonly, cache, i, padlen, getret;
int error = 0, rdonly, cache = 0, i, padlen, getret;
uint32_t len;
int v3 = (nfsd->nd_flag & ND_NFSV3);
char *cp2;
@ -587,7 +587,7 @@ nfsrv_read(nfsd, slp, lwp, mrq)
int32_t t1;
int i;
caddr_t bpos;
int error = 0, rdonly, cache, getret;
int error = 0, rdonly, cache = 0, getret;
int v3 = (nfsd->nd_flag & ND_NFSV3);
uint32_t reqlen, len, cnt, left;
int padlen;
@ -819,7 +819,7 @@ nfsrv_write(nfsd, slp, lwp, mrq)
u_int32_t *tl;
int32_t t1;
caddr_t bpos;
int error = 0, rdonly, cache, len, forat_ret = 1;
int error = 0, rdonly, cache = 0, len, forat_ret = 1;
int ioflags, aftat_ret = 1, retlen, zeroing, adjust;
int stable = NFSV3WRITE_FILESYNC;
int v3 = (nfsd->nd_flag & ND_NFSV3);
@ -1012,7 +1012,7 @@ nfsrv_writegather(ndp, slp, lwp, mrq)
u_int32_t *tl;
int32_t t1;
caddr_t bpos, dpos;
int error = 0, rdonly, cache, len = 0, forat_ret = 1;
int error = 0, rdonly, cache = 0, len = 0, forat_ret = 1;
int ioflags, aftat_ret = 1, s, adjust, v3, zeroing;
char *cp2;
struct mbuf *mb, *mreq, *mrep, *md;
@ -1377,7 +1377,7 @@ nfsrv_create(nfsd, slp, lwp, mrq)
caddr_t cp;
int32_t t1;
caddr_t bpos;
int error = 0, cache, len, tsize, dirfor_ret = 1, diraft_ret = 1;
int error = 0, cache = 0, len, tsize, dirfor_ret = 1, diraft_ret = 1;
int rdev = 0;
int v3 = (nfsd->nd_flag & ND_NFSV3), how, exclusive_flag = 0;
char *cp2;
@ -1606,7 +1606,7 @@ nfsrv_mknod(nfsd, slp, lwp, mrq)
struct nameidata nd;
int32_t t1;
caddr_t bpos;
int error = 0, cache, len, dirfor_ret = 1, diraft_ret = 1;
int error = 0, cache = 0, len, dirfor_ret = 1, diraft_ret = 1;
u_int32_t major, minor;
enum vtype vtyp;
char *cp2;
@ -1754,7 +1754,7 @@ nfsrv_remove(nfsd, slp, lwp, mrq)
u_int32_t *tl;
int32_t t1;
caddr_t bpos;
int error = 0, cache, len, dirfor_ret = 1, diraft_ret = 1;
int error = 0, cache = 0, len, dirfor_ret = 1, diraft_ret = 1;
int v3 = (nfsd->nd_flag & ND_NFSV3);
char *cp2;
struct mbuf *mb, *mreq;
@ -1842,7 +1842,7 @@ nfsrv_rename(nfsd, slp, lwp, mrq)
u_int32_t *tl;
int32_t t1;
caddr_t bpos;
int error = 0, cache, fdirfor_ret = 1, fdiraft_ret = 1;
int error = 0, cache = 0, fdirfor_ret = 1, fdiraft_ret = 1;
uint32_t len, len2;
int tdirfor_ret = 1, tdiraft_ret = 1;
int v3 = (nfsd->nd_flag & ND_NFSV3);
@ -2063,7 +2063,7 @@ nfsrv_link(nfsd, slp, lwp, mrq)
u_int32_t *tl;
int32_t t1;
caddr_t bpos;
int error = 0, rdonly, cache, len, dirfor_ret = 1, diraft_ret = 1;
int error = 0, rdonly, cache = 0, len, dirfor_ret = 1, diraft_ret = 1;
int getret = 1, v3 = (nfsd->nd_flag & ND_NFSV3);
char *cp2;
struct mbuf *mb, *mreq;
@ -2171,7 +2171,7 @@ nfsrv_symlink(nfsd, slp, lwp, mrq)
char *bpos, *pathcp = NULL, *cp2;
struct uio io;
struct iovec iv;
int error = 0, cache, dirfor_ret = 1, diraft_ret = 1;
int error = 0, cache = 0, dirfor_ret = 1, diraft_ret = 1;
uint32_t len, len2;
int v3 = (nfsd->nd_flag & ND_NFSV3);
struct mbuf *mb, *mreq;
@ -2316,7 +2316,7 @@ nfsrv_mkdir(nfsd, slp, lwp, mrq)
u_int32_t *tl;
int32_t t1;
caddr_t bpos;
int error = 0, cache, len, dirfor_ret = 1, diraft_ret = 1;
int error = 0, cache = 0, len, dirfor_ret = 1, diraft_ret = 1;
int v3 = (nfsd->nd_flag & ND_NFSV3);
char *cp2;
struct mbuf *mb, *mreq;
@ -2435,7 +2435,7 @@ nfsrv_rmdir(nfsd, slp, lwp, mrq)
u_int32_t *tl;
int32_t t1;
caddr_t bpos;
int error = 0, cache, len, dirfor_ret = 1, diraft_ret = 1;
int error = 0, cache = 0, len, dirfor_ret = 1, diraft_ret = 1;
int v3 = (nfsd->nd_flag & ND_NFSV3);
char *cp2;
struct mbuf *mb, *mreq;
@ -2588,7 +2588,7 @@ nfsrv_readdir(nfsd, slp, lwp, mrq)
struct uio io;
struct iovec iv;
int len, nlen, rem, xfer, tsiz, i, error = 0, getret = 1;
int siz, cnt, fullsiz, eofflag, rdonly, cache, ncookies;
int siz, cnt, fullsiz, eofflag, rdonly, cache = 0, ncookies;
int v3 = (nfsd->nd_flag & ND_NFSV3);
u_quad_t frev, off, toff, verf;
off_t *cookies = NULL, *cookiep;
@ -2852,7 +2852,7 @@ nfsrv_readdirplus(nfsd, slp, lwp, mrq)
struct vattr va, at, *vap = &va;
struct nfs_fattr *fp;
int len, nlen, rem, xfer, tsiz, i, error = 0, getret = 1;
int siz, cnt, fullsiz, eofflag, rdonly, cache, dirlen, ncookies;
int siz, cnt, fullsiz, eofflag, rdonly, cache = 0, dirlen, ncookies;
u_quad_t frev, off, toff, verf;
off_t *cookies = NULL, *cookiep;
@ -3153,16 +3153,13 @@ nfsrv_commit(nfsd, slp, lwp, mrq)
u_int32_t *tl;
int32_t t1;
caddr_t bpos;
int error = 0, rdonly, for_ret = 1, aft_ret = 1, cache;
int error = 0, rdonly, for_ret = 1, aft_ret = 1, cache = 0;
uint32_t cnt;
char *cp2;
struct mbuf *mb, *mreq;
u_quad_t frev, off, end;
struct mount *mp = NULL;
#ifndef nolint
cache = 0;
#endif
fhp = &nfh.fh_generic;
nfsm_srvmtofh(fhp);
if ((mp = vfs_getvfs(&fhp->fh_fsid)) == NULL)
@ -3223,7 +3220,7 @@ nfsrv_statfs(nfsd, slp, lwp, mrq)
u_int32_t *tl;
int32_t t1;
caddr_t bpos;
int error = 0, rdonly, cache, getret = 1;
int error = 0, rdonly, cache = 0, getret = 1;
int v3 = (nfsd->nd_flag & ND_NFSV3);
char *cp2;
struct mbuf *mb, *mreq;
@ -3234,9 +3231,6 @@ nfsrv_statfs(nfsd, slp, lwp, mrq)
struct statvfs statvfs;
u_quad_t frev, tval;
#ifndef nolint
cache = 0;
#endif
fhp = &nfh.fh_generic;
nfsm_srvmtofh(fhp);
error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam,
@ -3297,7 +3291,7 @@ nfsrv_fsinfo(nfsd, slp, lwp, mrq)
struct nfsv3_fsinfo *sip;
int32_t t1;
caddr_t bpos;
int error = 0, rdonly, cache, getret = 1;
int error = 0, rdonly, cache = 0, getret = 1;
uint32_t maxdata;
char *cp2;
struct mbuf *mb, *mreq;
@ -3308,9 +3302,6 @@ nfsrv_fsinfo(nfsd, slp, lwp, mrq)
u_quad_t frev, maxfsize;
struct statvfs sb;
#ifndef nolint
cache = 0;
#endif
fhp = &nfh.fh_generic;
nfsm_srvmtofh(fhp);
error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam,
@ -3374,7 +3365,7 @@ nfsrv_pathconf(nfsd, slp, lwp, mrq)
struct nfsv3_pathconf *pc;
int32_t t1;
caddr_t bpos;
int error = 0, rdonly, cache, getret = 1;
int error = 0, rdonly, cache = 0, getret = 1;
register_t linkmax, namemax, chownres, notrunc;
char *cp2;
struct mbuf *mb, *mreq;
@ -3384,9 +3375,6 @@ nfsrv_pathconf(nfsd, slp, lwp, mrq)
fhandle_t *fhp;
u_quad_t frev;
#ifndef nolint
cache = 0;
#endif
fhp = &nfh.fh_generic;
nfsm_srvmtofh(fhp);
error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam,