Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. =================================================================== RCS file: /ftp/cvs/cvsroot/src/sys/nfs/nfs_serv.c,v rcsdiff: /ftp/cvs/cvsroot/src/sys/nfs/nfs_serv.c,v: warning: Unknown phrases like `commitid ...;' are present. retrieving revision 1.110 retrieving revision 1.111 diff -u -p -r1.110 -r1.111 --- src/sys/nfs/nfs_serv.c 2006/06/07 22:34:17 1.110 +++ src/sys/nfs/nfs_serv.c 2006/06/09 21:41:14 1.111 @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_serv.c,v 1.110 2006/06/07 22:34:17 kardel Exp $ */ +/* $NetBSD: nfs_serv.c,v 1.111 2006/06/09 21:41:14 christos Exp $ */ /* * Copyright (c) 1989, 1993 @@ -55,7 +55,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.110 2006/06/07 22:34:17 kardel Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.111 2006/06/09 21:41:14 christos Exp $"); #include #include @@ -3251,7 +3251,7 @@ nfsrv_statfs(nfsd, slp, lwp, mrq) struct mbuf *nam = nfsd->nd_nam; caddr_t dpos = nfsd->nd_dpos; kauth_cred_t cred = nfsd->nd_cr; - struct statvfs *sf; + struct statvfs *sf = NULL; struct nfs_statfs *sfp; u_int32_t *tl; int32_t t1; @@ -3264,7 +3264,6 @@ nfsrv_statfs(nfsd, slp, lwp, mrq) struct vattr at; nfsfh_t nfh; fhandle_t *fhp; - struct statvfs statvfs; u_quad_t frev, tval; fhp = &nfh.fh_generic; @@ -3276,15 +3275,17 @@ nfsrv_statfs(nfsd, slp, lwp, mrq) nfsm_srvpostop_attr(getret, &at); return (0); } - sf = &statvfs; + sf = malloc(sizeof(*sf), M_TEMP, M_WAITOK); error = VFS_STATVFS(vp->v_mount, sf, lwp); getret = VOP_GETATTR(vp, &at, cred, lwp); vput(vp); nfsm_reply(NFSX_POSTOPATTR(v3) + NFSX_STATFS(v3)); if (v3) nfsm_srvpostop_attr(getret, &at); - if (error) + if (error) { + free(sf, M_TEMP); return (0); + } nfsm_build(sfp, struct nfs_statfs *, NFSX_STATFS(v3)); if (v3) { tval = (u_quad_t)((quad_t)sf->f_blocks * (quad_t)sf->f_frsize); @@ -3306,7 +3307,10 @@ nfsrv_statfs(nfsd, slp, lwp, mrq) sfp->sf_bfree = txdr_unsigned(sf->f_bfree); sfp->sf_bavail = txdr_unsigned(sf->f_bavail); } - nfsm_srvdone; +nfsmout: + if (sf) + free(sf, M_TEMP); + return error; } /* @@ -3336,7 +3340,7 @@ nfsrv_fsinfo(nfsd, slp, lwp, mrq) nfsfh_t nfh; fhandle_t *fhp; u_quad_t frev, maxfsize; - struct statvfs sb; + struct statvfs *sb; fhp = &nfh.fh_generic; nfsm_srvmtofh(fhp); @@ -3349,8 +3353,10 @@ nfsrv_fsinfo(nfsd, slp, lwp, mrq) } /* XXX Try to make a guess on the max file size. */ - VFS_STATVFS(vp->v_mount, &sb, (struct lwp *)0); - maxfsize = (u_quad_t)0x80000000 * sb.f_frsize - 1; + sb = malloc(sizeof(*sb), M_TEMP, M_WAITOK); + VFS_STATVFS(vp->v_mount, sb, (struct lwp *)0); + maxfsize = (u_quad_t)0x80000000 * sb->f_frsize - 1; + free(sb, M_TEMP); getret = VOP_GETATTR(vp, &at, cred, lwp); vput(vp);