From 261ca79adc4eed000e7c385a1759a9815784a50f Mon Sep 17 00:00:00 2001 From: "Thordur I. Bjornsson" Date: Wed, 24 Dec 2008 16:53:21 +0000 Subject: Low hanging macro fruit. Inline the nfsm_srvstrsiz macro since its used only once and nuke its definition. Stolen from blambert's bag'o'diffs. OK blambert@. --- sys/nfs/nfs_serv.c | 11 +++++++++-- sys/nfs/nfsm_subs.h | 9 +-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c index 2f2320e6361..549998b1fa4 100644 --- a/sys/nfs/nfs_serv.c +++ b/sys/nfs/nfs_serv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_serv.c,v 1.59 2008/12/24 02:43:52 thib Exp $ */ +/* $OpenBSD: nfs_serv.c,v 1.60 2008/12/24 16:53:20 thib Exp $ */ /* $NetBSD: nfs_serv.c,v 1.34 1997/05/12 23:37:12 fvdl Exp $ */ /* @@ -537,7 +537,14 @@ nfsrv_read(nfsd, slp, procp, mrq) nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); off = (off_t)fxdr_unsigned(u_int32_t, *tl); } - nfsm_srvstrsiz(reqlen, NFS_SRVMAXDATA(nfsd)); + + nfsm_dissect(tl, u_int32_t *, NFSX_UNSIGNED); + reqlen = fxdr_unsigned(int32_t, *tl); + if (reqlen > (NFS_SRVMAXDATA(nfsd)) || reqlen <= 0) { + error = EBADRPC; + nfsm_reply(0); + } + error = nfsrv_fhtovp(fhp, 1, &vp, cred, slp, nam, &rdonly); if (error) { nfsm_reply(2 * NFSX_UNSIGNED); diff --git a/sys/nfs/nfsm_subs.h b/sys/nfs/nfsm_subs.h index debd07f01c2..54014291aca 100644 --- a/sys/nfs/nfsm_subs.h +++ b/sys/nfs/nfsm_subs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: nfsm_subs.h,v 1.31 2008/06/15 04:03:40 thib Exp $ */ +/* $OpenBSD: nfsm_subs.h,v 1.32 2008/12/24 16:53:20 thib Exp $ */ /* $NetBSD: nfsm_subs.h,v 1.10 1996/03/20 21:59:56 fvdl Exp $ */ /* @@ -194,13 +194,6 @@ goto nfsmout; \ } } -#define nfsm_srvstrsiz(s,m) \ - { nfsm_dissect(tl,u_int32_t *,NFSX_UNSIGNED); \ - if (((s) = fxdr_unsigned(int32_t,*tl)) > (m) || (s) <= 0) { \ - error = EBADRPC; \ - nfsm_reply(0); \ - } } - #define nfsm_srvnamesiz(s) \ { nfsm_dissect(tl,u_int32_t *,NFSX_UNSIGNED); \ if (((s) = fxdr_unsigned(int32_t,*tl)) > NFS_MAXNAMLEN) \ -- cgit v1.2.3