Author: cem
Date: Thu Jan 25 22:25:13 2018
New Revision: 328417
URL: https://svnweb.freebsd.org/changeset/base/328417

Log:
  style: Remove remaining deprecated MALLOC/FREE macros
  
  Mechanically replace uses of MALLOC/FREE with appropriate invocations of
  malloc(9) / free(9) (a series of sed expressions).  Something like:
  
  * MALLOC(a, b, ... -> a = malloc(...
  * FREE( -> free(
  * free((caddr_t) -> free(
  
  No functional change.
  
  For now, punt on modifying contrib ipfilter code, leaving a definition of
  the macro in its KMALLOC().
  
  Reported by:  jhb
  Reviewed by:  cy, imp, markj, rmacklem
  Sponsored by: Dell EMC Isilon
  Differential Revision:        https://reviews.freebsd.org/D14035

Modified:
  head/sys/contrib/ipfilter/netinet/ip_compat.h
  head/sys/fs/nfs/nfs_commonkrpc.c
  head/sys/fs/nfs/nfs_commonsubs.c
  head/sys/fs/nfs/nfsport.h
  head/sys/fs/nfsclient/nfs_clcomsubs.c
  head/sys/fs/nfsclient/nfs_clnode.c
  head/sys/fs/nfsclient/nfs_clport.c
  head/sys/fs/nfsclient/nfs_clrpcops.c
  head/sys/fs/nfsclient/nfs_clstate.c
  head/sys/fs/nfsclient/nfs_clsubs.c
  head/sys/fs/nfsclient/nfs_clvfsops.c
  head/sys/fs/nfsclient/nfs_clvnops.c
  head/sys/fs/nfsclient/nfsnode.h
  head/sys/fs/nfsserver/nfs_nfsdcache.c
  head/sys/fs/nfsserver/nfs_nfsdport.c
  head/sys/fs/nfsserver/nfs_nfsdserv.c
  head/sys/fs/nfsserver/nfs_nfsdstate.c
  head/sys/netinet/ip_mroute.c
  head/sys/nfsclient/nfsnode.h
  head/sys/sys/malloc.h

Modified: head/sys/contrib/ipfilter/netinet/ip_compat.h
==============================================================================
--- head/sys/contrib/ipfilter/netinet/ip_compat.h       Thu Jan 25 21:48:07 
2018        (r328416)
+++ head/sys/contrib/ipfilter/netinet/ip_compat.h       Thu Jan 25 22:25:13 
2018        (r328417)
@@ -530,16 +530,16 @@ MALLOC_DECLARE(M_IPFILTER);
 #   endif /* M_PFIL */
 #  endif /* IPFILTER_M_IPFILTER */
 #  if !defined(KMALLOC)
-#   define     KMALLOC(a, b)   MALLOC((a), b, sizeof(*(a)), _M_IPF, M_NOWAIT)
+#   define     KMALLOC(a, b)           (a) = (b)malloc(sizeof(*(a)), _M_IPF, 
M_NOWAIT)
 #  endif
 #  if !defined(KMALLOCS)
-#   define     KMALLOCS(a, b, c)       MALLOC((a), b, (c), _M_IPF, M_NOWAIT)
+#   define     KMALLOCS(a, b, c)       (a) = (b)malloc((c), _M_IPF, M_NOWAIT)
 #  endif
 #  if !defined(KFREE)
-#   define     KFREE(x)        FREE((x), _M_IPF)
+#   define     KFREE(x)        free((x), _M_IPF)
 #  endif
 #   if !defined(KFREES)
-#  define      KFREES(x,s)     FREE((x), _M_IPF)
+#  define      KFREES(x,s)     free((x), _M_IPF)
 #  endif
 #  define      UIOMOVE(a,b,c,d)        uiomove((caddr_t)a,b,d)
 #  define      SLEEP(id, n)    tsleep((id), PPAUSE|PCATCH, n, 0)

Modified: head/sys/fs/nfs/nfs_commonkrpc.c
==============================================================================
--- head/sys/fs/nfs/nfs_commonkrpc.c    Thu Jan 25 21:48:07 2018        
(r328416)
+++ head/sys/fs/nfs/nfs_commonkrpc.c    Thu Jan 25 22:25:13 2018        
(r328417)
@@ -676,7 +676,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmo
                 * outstanding RPCs for nfsv4 client requests.
                 */
                if ((nd->nd_flag & ND_NFSV4) && procnum == NFSV4PROC_COMPOUND)
-                       MALLOC(rep, struct nfsreq *, sizeof(struct nfsreq),
+                       rep = malloc(sizeof(struct nfsreq),
                            M_NFSDREQ, M_WAITOK);
 #ifdef KDTRACE_HOOKS
                if (dtrace_nfscl_nfs234_start_probe != NULL) {
@@ -798,7 +798,7 @@ tryagain:
                if (usegssname == 0)
                        AUTH_DESTROY(auth);
                if (rep != NULL)
-                       FREE((caddr_t)rep, M_NFSDREQ);
+                       free(rep, M_NFSDREQ);
                if (set_sigset)
                        newnfs_restore_sigmask(td, &oldset);
                return (error);
@@ -1098,7 +1098,7 @@ tryagain:
        if (usegssname == 0)
                AUTH_DESTROY(auth);
        if (rep != NULL)
-               FREE((caddr_t)rep, M_NFSDREQ);
+               free(rep, M_NFSDREQ);
        if (set_sigset)
                newnfs_restore_sigmask(td, &oldset);
        return (0);
@@ -1108,7 +1108,7 @@ nfsmout:
        if (usegssname == 0)
                AUTH_DESTROY(auth);
        if (rep != NULL)
-               FREE((caddr_t)rep, M_NFSDREQ);
+               free(rep, M_NFSDREQ);
        if (set_sigset)
                newnfs_restore_sigmask(td, &oldset);
        return (error);

Modified: head/sys/fs/nfs/nfs_commonsubs.c
==============================================================================
--- head/sys/fs/nfs/nfs_commonsubs.c    Thu Jan 25 21:48:07 2018        
(r328416)
+++ head/sys/fs/nfs/nfs_commonsubs.c    Thu Jan 25 22:25:13 2018        
(r328417)
@@ -677,11 +677,11 @@ nfsm_getfh(struct nfsrv_descript *nd, struct nfsfh **n
                }
        } else
                len = NFSX_V2FH;
-       MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) + len,
+       nfhp = malloc(sizeof (struct nfsfh) + len,
            M_NFSFH, M_WAITOK);
        error = nfsrv_mtostr(nd, nfhp->nfh_fh, len);
        if (error) {
-               FREE((caddr_t)nfhp, M_NFSFH);
+               free(nfhp, M_NFSFH);
                goto nfsmout;
        }
        nfhp->nfh_len = len;
@@ -1200,11 +1200,11 @@ nfsv4_loadattr(struct nfsrv_descript *nd, vnode_t vp,
                                    !NFSRV_CMPFH(tnfhp->nfh_fh, tfhsize,
                                     fhp, fhsize))
                                        *retcmpp = NFSERR_NOTSAME;
-                               FREE((caddr_t)tnfhp, M_NFSFH);
+                               free(tnfhp, M_NFSFH);
                        } else if (nfhpp != NULL) {
                                *nfhpp = tnfhp;
                        } else {
-                               FREE((caddr_t)tnfhp, M_NFSFH);
+                               free(tnfhp, M_NFSFH);
                        }
                        attrsum += (NFSX_UNSIGNED + NFSM_RNDUP(tfhsize));
                        break;
@@ -3832,7 +3832,7 @@ nfsrv_getrefstr(struct nfsrv_descript *nd, u_char **fs
                        cp3 += stringlen;
                        *cp3 = '\0';
                        siz += (lsp->len + stringlen + 2);
-                       free((caddr_t)lsp, M_TEMP);
+                       free(lsp, M_TEMP);
                }
        }
        *fsrootp = cp;

Modified: head/sys/fs/nfs/nfsport.h
==============================================================================
--- head/sys/fs/nfs/nfsport.h   Thu Jan 25 21:48:07 2018        (r328416)
+++ head/sys/fs/nfs/nfsport.h   Thu Jan 25 22:25:13 2018        (r328417)
@@ -630,7 +630,7 @@ void nfsrvd_rcv(struct socket *, void *, int);
 #define        NFSSOCKADDR(a, t)       ((t)(a))
 #define        NFSSOCKADDRALLOC(a)                                     \
     do {                                                       \
-       MALLOC((a), struct sockaddr *, sizeof (struct sockaddr), \
+       (a) = malloc(sizeof (struct sockaddr),                  \
            M_SONAME, M_WAITOK);                                \
        NFSBZERO((a), sizeof (struct sockaddr));                \
     } while (0)
@@ -638,7 +638,7 @@ void nfsrvd_rcv(struct socket *, void *, int);
 #define        NFSSOCKADDRFREE(a)                                      \
        do {                                                    \
                if (a)                                          \
-                       FREE((caddr_t)(a), M_SONAME);           \
+                       free((a), M_SONAME);            \
        } while (0)
 
 /*

Modified: head/sys/fs/nfsclient/nfs_clcomsubs.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clcomsubs.c       Thu Jan 25 21:48:07 2018        
(r328416)
+++ head/sys/fs/nfsclient/nfs_clcomsubs.c       Thu Jan 25 22:25:13 2018        
(r328417)
@@ -499,7 +499,7 @@ nfscl_getcookie(struct nfsnode *np, off_t off, int add
        dp = LIST_FIRST(&np->n_cookies);
        if (!dp) {
                if (add) {
-                       MALLOC(dp, struct nfsdmap *, sizeof (struct nfsdmap),
+                       dp = malloc(sizeof (struct nfsdmap),
                                M_NFSDIROFF, M_WAITOK);
                        dp->ndm_eocookie = 0;
                        LIST_INSERT_HEAD(&np->n_cookies, dp, ndm_list);
@@ -514,7 +514,7 @@ nfscl_getcookie(struct nfsnode *np, off_t off, int add
                                return (NULL);
                        dp = LIST_NEXT(dp, ndm_list);
                } else if (add) {
-                       MALLOC(dp2, struct nfsdmap *, sizeof (struct nfsdmap),
+                       dp2 = malloc(sizeof (struct nfsdmap),
                                M_NFSDIROFF, M_WAITOK);
                        dp2->ndm_eocookie = 0;
                        LIST_INSERT_AFTER(dp, dp2, ndm_list);

Modified: head/sys/fs/nfsclient/nfs_clnode.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clnode.c  Thu Jan 25 21:48:07 2018        
(r328416)
+++ head/sys/fs/nfsclient/nfs_clnode.c  Thu Jan 25 22:25:13 2018        
(r328417)
@@ -111,13 +111,13 @@ ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize
 
        hash = fnv_32_buf(fhp, fhsize, FNV1_32_INIT);
 
-       MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) + fhsize,
+       nfhp = malloc(sizeof (struct nfsfh) + fhsize,
            M_NFSFH, M_WAITOK);
        bcopy(fhp, &nfhp->nfh_fh[0], fhsize);
        nfhp->nfh_len = fhsize;
        error = vfs_hash_get(mntp, hash, lkflags,
            td, &nvp, newnfs_vncmpf, nfhp);
-       FREE(nfhp, M_NFSFH);
+       free(nfhp, M_NFSFH);
        if (error)
                return (error);
        if (nvp != NULL) {
@@ -163,14 +163,14 @@ ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize
                vp->v_vflag |= VV_ROOT;
        }
        
-       MALLOC(np->n_fhp, struct nfsfh *, sizeof (struct nfsfh) + fhsize,
+       np->n_fhp = malloc(sizeof (struct nfsfh) + fhsize,
            M_NFSFH, M_WAITOK);
        bcopy(fhp, np->n_fhp->nfh_fh, fhsize);
        np->n_fhp->nfh_len = fhsize;
        error = insmntque(vp, mntp);
        if (error != 0) {
                *npp = NULL;
-               FREE((caddr_t)np->n_fhp, M_NFSFH);
+               free(np->n_fhp, M_NFSFH);
                mtx_destroy(&np->n_mtx);
                lockdestroy(&np->n_excl);
                uma_zfree(newnfsnode_zone, np);
@@ -329,14 +329,14 @@ ncl_reclaim(struct vop_reclaim_args *ap)
                while (dp) {
                        dp2 = dp;
                        dp = LIST_NEXT(dp, ndm_list);
-                       FREE((caddr_t)dp2, M_NFSDIROFF);
+                       free(dp2, M_NFSDIROFF);
                }
        }
        if (np->n_writecred != NULL)
                crfree(np->n_writecred);
-       FREE((caddr_t)np->n_fhp, M_NFSFH);
+       free(np->n_fhp, M_NFSFH);
        if (np->n_v4 != NULL)
-               FREE((caddr_t)np->n_v4, M_NFSV4NODE);
+               free(np->n_v4, M_NFSV4NODE);
        mtx_destroy(&np->n_mtx);
        lockdestroy(&np->n_excl);
        uma_zfree(newnfsnode_zone, vp->v_data);

Modified: head/sys/fs/nfsclient/nfs_clport.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clport.c  Thu Jan 25 21:48:07 2018        
(r328416)
+++ head/sys/fs/nfsclient/nfs_clport.c  Thu Jan 25 22:25:13 2018        
(r328417)
@@ -163,7 +163,7 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, stru
                }
        }
        if (error) {
-               FREE((caddr_t)nfhp, M_NFSFH);
+               free(nfhp, M_NFSFH);
                return (error);
        }
        if (nvp != NULL) {
@@ -181,7 +181,7 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, stru
                     dnp->n_fhp->nfh_len != np->n_v4->n4_fhlen ||
                     NFSBCMP(dnp->n_fhp->nfh_fh, np->n_v4->n4_data,
                     dnp->n_fhp->nfh_len))) {
-                   MALLOC(newd, struct nfsv4node *,
+                   newd = malloc(
                        sizeof (struct nfsv4node) + dnp->n_fhp->nfh_len +
                        + cnp->cn_namelen - 1, M_NFSV4NODE, M_WAITOK);
                    NFSLOCKNODE(np);
@@ -205,11 +205,11 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, stru
                    NFSUNLOCKNODE(np);
                }
                if (newd != NULL)
-                       FREE((caddr_t)newd, M_NFSV4NODE);
+                       free(newd, M_NFSV4NODE);
                if (oldd != NULL)
-                       FREE((caddr_t)oldd, M_NFSV4NODE);
+                       free(oldd, M_NFSV4NODE);
                *npp = np;
-               FREE((caddr_t)nfhp, M_NFSFH);
+               free(nfhp, M_NFSFH);
                return (0);
        }
        np = uma_zalloc(newnfsnode_zone, M_WAITOK | M_ZERO);
@@ -217,7 +217,7 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, stru
        error = getnewvnode(nfs_vnode_tag, mntp, &newnfs_vnodeops, &nvp);
        if (error) {
                uma_zfree(newnfsnode_zone, np);
-               FREE((caddr_t)nfhp, M_NFSFH);
+               free(nfhp, M_NFSFH);
                return (error);
        }
        vp = nvp;
@@ -252,7 +252,7 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, stru
         * file name, so that Open Ops can be done later.
         */
        if (nmp->nm_flag & NFSMNT_NFSV4) {
-               MALLOC(np->n_v4, struct nfsv4node *, sizeof (struct nfsv4node)
+               np->n_v4 = malloc(sizeof (struct nfsv4node)
                    + dnp->n_fhp->nfh_len + cnp->cn_namelen - 1, M_NFSV4NODE,
                    M_WAITOK);
                np->n_v4->n4_fhlen = dnp->n_fhp->nfh_len;
@@ -276,9 +276,9 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, stru
                *npp = NULL;
                mtx_destroy(&np->n_mtx);
                lockdestroy(&np->n_excl);
-               FREE((caddr_t)nfhp, M_NFSFH);
+               free(nfhp, M_NFSFH);
                if (np->n_v4 != NULL)
-                       FREE((caddr_t)np->n_v4, M_NFSV4NODE);
+                       free(np->n_v4, M_NFSV4NODE);
                uma_zfree(newnfsnode_zone, np);
                return (error);
        }
@@ -320,7 +320,7 @@ nfscl_ngetreopen(struct mount *mntp, u_int8_t *fhp, in
        /* For forced dismounts, just return error. */
        if (NFSCL_FORCEDISM(mntp))
                return (EINTR);
-       MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) + fhsize,
+       nfhp = malloc(sizeof (struct nfsfh) + fhsize,
            M_NFSFH, M_WAITOK);
        bcopy(fhp, &nfhp->nfh_fh[0], fhsize);
        nfhp->nfh_len = fhsize;
@@ -355,7 +355,7 @@ nfscl_ngetreopen(struct mount *mntp, u_int8_t *fhp, in
                        }
                }
        }
-       FREE(nfhp, M_NFSFH);
+       free(nfhp, M_NFSFH);
        if (error)
                return (error);
        if (nvp != NULL) {

Modified: head/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clrpcops.c        Thu Jan 25 21:48:07 2018        
(r328416)
+++ head/sys/fs/nfsclient/nfs_clrpcops.c        Thu Jan 25 22:25:13 2018        
(r328417)
@@ -538,7 +538,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int
                              NFSCLFLAGS_FIRSTDELEG))
                                op->nfso_own->nfsow_clp->nfsc_flags |=
                                  (NFSCLFLAGS_FIRSTDELEG | NFSCLFLAGS_GOTDELEG);
-                       MALLOC(ndp, struct nfscldeleg *,
+                       ndp = malloc(
                            sizeof (struct nfscldeleg) + newfhlen,
                            M_NFSCLDELEG, M_WAITOK);
                        LIST_INIT(&ndp->nfsdl_owner);
@@ -634,7 +634,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int
                    } while (ret == NFSERR_DELAY);
                    if (ret) {
                        if (ndp != NULL) {
-                               FREE((caddr_t)ndp, M_NFSCLDELEG);
+                               free(ndp, M_NFSCLDELEG);
                                ndp = NULL;
                        }
                        if (ret == NFSERR_STALECLIENTID ||
@@ -652,7 +652,7 @@ nfsmout:
        if (!error)
                *dpp = ndp;
        else if (ndp != NULL)
-               FREE((caddr_t)ndp, M_NFSCLDELEG);
+               free(ndp, M_NFSCLDELEG);
        mbuf_freem(nd->nd_mrep);
        return (error);
 }
@@ -1324,7 +1324,7 @@ nfsrpc_lookup(vnode_t dvp, char *name, int len, struct
                 * Just return the current dir's fh.
                 */
                np = VTONFS(dvp);
-               MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) +
+               nfhp = malloc(sizeof (struct nfsfh) +
                        np->n_fhp->nfh_len, M_NFSFH, M_WAITOK);
                nfhp->nfh_len = np->n_fhp->nfh_len;
                NFSBCOPY(np->n_fhp->nfh_fh, nfhp->nfh_fh, nfhp->nfh_len);
@@ -1356,7 +1356,7 @@ nfsrpc_lookup(vnode_t dvp, char *name, int len, struct
                 */
                if (nd->nd_repstat == NFSERR_NOENT && lookupp) {
                    np = VTONFS(dvp);
-                   MALLOC(nfhp, struct nfsfh *, sizeof (struct nfsfh) +
+                   nfhp = malloc(sizeof (struct nfsfh) +
                        np->n_fhp->nfh_len, M_NFSFH, M_WAITOK);
                    nfhp->nfh_len = np->n_fhp->nfh_len;
                    NFSBCOPY(np->n_fhp->nfh_fh, nfhp->nfh_fh, nfhp->nfh_len);
@@ -2182,7 +2182,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, int namelen, 
                              NFSCLFLAGS_FIRSTDELEG))
                                owp->nfsow_clp->nfsc_flags |=
                                  (NFSCLFLAGS_FIRSTDELEG | NFSCLFLAGS_GOTDELEG);
-                       MALLOC(dp, struct nfscldeleg *,
+                       dp = malloc(
                            sizeof (struct nfscldeleg) + NFSX_V4FHMAX,
                            M_NFSCLDELEG, M_WAITOK);
                        LIST_INIT(&dp->nfsdl_owner);
@@ -2296,7 +2296,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, int namelen, 
                    } while (ret == NFSERR_DELAY);
                    if (ret) {
                        if (dp != NULL) {
-                               FREE((caddr_t)dp, M_NFSCLDELEG);
+                               free(dp, M_NFSCLDELEG);
                                dp = NULL;
                        }
                        if (ret == NFSERR_STALECLIENTID ||
@@ -2316,7 +2316,7 @@ nfsmout:
        if (!error)
                *dpp = dp;
        else if (dp != NULL)
-               FREE((caddr_t)dp, M_NFSCLDELEG);
+               free(dp, M_NFSCLDELEG);
        mbuf_freem(nd->nd_mrep);
        return (error);
 }
@@ -3568,7 +3568,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui
                                            goto nfsmout;
                                }
                                if (!attrflag && nfhp != NULL) {
-                                       FREE((caddr_t)nfhp, M_NFSFH);
+                                       free(nfhp, M_NFSFH);
                                        nfhp = NULL;
                                }
                        } else {
@@ -3616,7 +3616,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui
                                    VREF(vp);
                                    newvp = vp;
                                    unlocknewvp = 0;
-                                   FREE((caddr_t)nfhp, M_NFSFH);
+                                   free(nfhp, M_NFSFH);
                                    np = dnp;
                                } else if (isdotdot != 0) {
                                    /*
@@ -3674,7 +3674,7 @@ nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui
                                }
                            }
                        } else if (nfhp != NULL) {
-                           FREE((caddr_t)nfhp, M_NFSFH);
+                           free(nfhp, M_NFSFH);
                        }
                        NFSM_DISSECT(tl, u_int32_t *, NFSX_UNSIGNED);
                        more_dirs = fxdr_unsigned(int, *tl);

Modified: head/sys/fs/nfsclient/nfs_clstate.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clstate.c Thu Jan 25 21:48:07 2018        
(r328416)
+++ head/sys/fs/nfsclient/nfs_clstate.c Thu Jan 25 22:25:13 2018        
(r328417)
@@ -234,16 +234,16 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, int fhlen, u_in
         * Might need one or both of these, so MALLOC them now, to
         * avoid a tsleep() in MALLOC later.
         */
-       MALLOC(nowp, struct nfsclowner *, sizeof (struct nfsclowner),
+       nowp = malloc(sizeof (struct nfsclowner),
            M_NFSCLOWNER, M_WAITOK);
        if (nfhp != NULL)
-           MALLOC(nop, struct nfsclopen *, sizeof (struct nfsclopen) +
+           nop = malloc(sizeof (struct nfsclopen) +
                fhlen - 1, M_NFSCLOPEN, M_WAITOK);
        ret = nfscl_getcl(vnode_mount(vp), cred, p, 1, &clp);
        if (ret != 0) {
-               FREE((caddr_t)nowp, M_NFSCLOWNER);
+               free(nowp, M_NFSCLOWNER);
                if (nop != NULL)
-                       FREE((caddr_t)nop, M_NFSCLOPEN);
+                       free(nop, M_NFSCLOPEN);
                return (ret);
        }
 
@@ -331,9 +331,9 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, int fhlen, u_in
        }
        NFSUNLOCKCLSTATE();
        if (nowp != NULL)
-               FREE((caddr_t)nowp, M_NFSCLOWNER);
+               free(nowp, M_NFSCLOWNER);
        if (nop != NULL)
-               FREE((caddr_t)nop, M_NFSCLOPEN);
+               free(nop, M_NFSCLOPEN);
        if (owpp != NULL)
                *owpp = owp;
        if (opp != NULL)
@@ -440,7 +440,7 @@ nfscl_deleg(mount_t mp, struct nfsclclient *clp, u_int
        if (mp != NULL && dp != NULL && !NFSMNT_RDONLY(mp) &&
            (dp->nfsdl_flags & NFSCLDL_READ)) {
                (void) nfscl_trydelegreturn(dp, cred, VFSTONFS(mp), p);
-               FREE((caddr_t)dp, M_NFSCLDELEG);
+               free(dp, M_NFSCLDELEG);
                *dpp = NULL;
                return (0);
        }
@@ -466,7 +466,7 @@ nfscl_deleg(mount_t mp, struct nfsclclient *clp, u_int
                 */
                if (dp != NULL) {
                        printf("Deleg already exists!\n");
-                       FREE((caddr_t)dp, M_NFSCLDELEG);
+                       free(dp, M_NFSCLDELEG);
                        *dpp = NULL;
                } else {
                        *dpp = tdp;
@@ -795,7 +795,7 @@ nfscl_getcl(struct mount *mp, struct ucred *cred, NFSP
                        idlen += sizeof (u_int64_t);
                else
                        idlen += sizeof (u_int64_t) + 16; /* 16 random bytes */
-               MALLOC(newclp, struct nfsclclient *,
+               newclp = malloc(
                    sizeof (struct nfsclclient) + idlen - 1, M_NFSCLCLIENT,
                    M_WAITOK | M_ZERO);
        }
@@ -1012,11 +1012,11 @@ nfscl_getbytelock(vnode_t vp, u_int64_t off, u_int64_t
         * Might need these, so MALLOC them now, to
         * avoid a tsleep() in MALLOC later.
         */
-       MALLOC(nlp, struct nfscllockowner *,
+       nlp = malloc(
            sizeof (struct nfscllockowner), M_NFSCLLOCKOWNER, M_WAITOK);
-       MALLOC(otherlop, struct nfscllock *,
+       otherlop = malloc(
            sizeof (struct nfscllock), M_NFSCLLOCK, M_WAITOK);
-       MALLOC(nlop, struct nfscllock *,
+       nlop = malloc(
            sizeof (struct nfscllock), M_NFSCLLOCK, M_WAITOK);
        nlop->nfslo_type = type;
        nlop->nfslo_first = off;
@@ -1035,9 +1035,9 @@ nfscl_getbytelock(vnode_t vp, u_int64_t off, u_int64_t
                        error = nfscl_getcl(vnode_mount(vp), cred, p, 1, &clp);
        }
        if (error) {
-               FREE((caddr_t)nlp, M_NFSCLLOCKOWNER);
-               FREE((caddr_t)otherlop, M_NFSCLLOCK);
-               FREE((caddr_t)nlop, M_NFSCLLOCK);
+               free(nlp, M_NFSCLLOCKOWNER);
+               free(otherlop, M_NFSCLLOCK);
+               free(nlop, M_NFSCLLOCK);
                return (error);
        }
 
@@ -1106,9 +1106,9 @@ nfscl_getbytelock(vnode_t vp, u_int64_t off, u_int64_t
                        nfscl_clrelease(clp);
                        NFSUNLOCKCLSTATE();
                }
-               FREE((caddr_t)nlp, M_NFSCLLOCKOWNER);
-               FREE((caddr_t)otherlop, M_NFSCLLOCK);
-               FREE((caddr_t)nlop, M_NFSCLLOCK);
+               free(nlp, M_NFSCLLOCKOWNER);
+               free(otherlop, M_NFSCLLOCK);
+               free(nlop, M_NFSCLLOCK);
                return (error);
        }
 
@@ -1168,11 +1168,11 @@ nfscl_getbytelock(vnode_t vp, u_int64_t off, u_int64_t
                NFSUNLOCKCLSTATE();
 
        if (nlp)
-               FREE((caddr_t)nlp, M_NFSCLLOCKOWNER);
+               free(nlp, M_NFSCLLOCKOWNER);
        if (nlop)
-               FREE((caddr_t)nlop, M_NFSCLLOCK);
+               free(nlop, M_NFSCLLOCK);
        if (otherlop)
-               FREE((caddr_t)otherlop, M_NFSCLLOCK);
+               free(otherlop, M_NFSCLLOCK);
 
        *lpp = lp;
        return (0);
@@ -1204,7 +1204,7 @@ nfscl_relbytelock(vnode_t vp, u_int64_t off, u_int64_t
         * Might need these, so MALLOC them now, to
         * avoid a tsleep() in MALLOC later.
         */
-       MALLOC(nlop, struct nfscllock *,
+       nlop = malloc(
            sizeof (struct nfscllock), M_NFSCLLOCK, M_WAITOK);
        nlop->nfslo_type = F_UNLCK;
        nlop->nfslo_first = off;
@@ -1213,12 +1213,12 @@ nfscl_relbytelock(vnode_t vp, u_int64_t off, u_int64_t
        } else {
                nlop->nfslo_end = off + len;
                if (nlop->nfslo_end <= nlop->nfslo_first) {
-                       FREE((caddr_t)nlop, M_NFSCLLOCK);
+                       free(nlop, M_NFSCLLOCK);
                        return (NFSERR_INVAL);
                }
        }
        if (callcnt == 0) {
-               MALLOC(other_lop, struct nfscllock *,
+               other_lop = malloc(
                    sizeof (struct nfscllock), M_NFSCLLOCK, M_WAITOK);
                *other_lop = *nlop;
        }
@@ -1284,9 +1284,9 @@ nfscl_relbytelock(vnode_t vp, u_int64_t off, u_int64_t
        }
        NFSUNLOCKCLSTATE();
        if (nlop)
-               FREE((caddr_t)nlop, M_NFSCLLOCK);
+               free(nlop, M_NFSCLLOCK);
        if (other_lop)
-               FREE((caddr_t)other_lop, M_NFSCLLOCK);
+               free(other_lop, M_NFSCLLOCK);
        return (0);
 }
 
@@ -1464,7 +1464,7 @@ nfscl_freeopen(struct nfsclopen *op, int local)
 
        LIST_REMOVE(op, nfso_list);
        nfscl_freealllocks(&op->nfso_lock, local);
-       FREE((caddr_t)op, M_NFSCLOPEN);
+       free(op, M_NFSCLOPEN);
        if (local)
                nfsstatsv1.cllocalopens--;
        else
@@ -1520,7 +1520,7 @@ nfscl_expireopen(struct nfsclclient *clp, struct nfscl
                if (error) {
                        mustdelete = 1;
                        if (dp != NULL) {
-                               FREE((caddr_t)dp, M_NFSCLDELEG);
+                               free(dp, M_NFSCLDELEG);
                                dp = NULL;
                        }
                }
@@ -1545,7 +1545,7 @@ nfscl_freeopenowner(struct nfsclowner *owp, int local)
 {
 
        LIST_REMOVE(owp, nfsow_list);
-       FREE((caddr_t)owp, M_NFSCLOWNER);
+       free(owp, M_NFSCLOWNER);
        if (local)
                nfsstatsv1.cllocalopenowners--;
        else
@@ -1564,7 +1564,7 @@ nfscl_freelockowner(struct nfscllockowner *lp, int loc
        LIST_FOREACH_SAFE(lop, &lp->nfsl_lock, nfslo_list, nlop) {
                nfscl_freelock(lop, local);
        }
-       FREE((caddr_t)lp, M_NFSCLLOCKOWNER);
+       free(lp, M_NFSCLLOCKOWNER);
        if (local)
                nfsstatsv1.cllocallockowners--;
        else
@@ -1579,7 +1579,7 @@ nfscl_freelock(struct nfscllock *lop, int local)
 {
 
        LIST_REMOVE(lop, nfslo_list);
-       FREE((caddr_t)lop, M_NFSCLLOCK);
+       free(lop, M_NFSCLLOCK);
        if (local)
                nfsstatsv1.cllocallocks--;
        else
@@ -1616,7 +1616,7 @@ nfscl_freedeleg(struct nfscldeleghead *hdp, struct nfs
 
        TAILQ_REMOVE(hdp, dp, nfsdl_list);
        LIST_REMOVE(dp, nfsdl_hash);
-       FREE((caddr_t)dp, M_NFSCLDELEG);
+       free(dp, M_NFSCLDELEG);
        nfsstatsv1.cldelegates--;
        nfscl_delegcnt--;
 }
@@ -2104,7 +2104,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *c
                                    dp->nfsdl_flags &= ~NFSCLDL_NEEDRECLAIM;
                                    if ((ndp->nfsdl_flags & NFSCLDL_RECALL))
                                        dp->nfsdl_flags |= NFSCLDL_RECALL;
-                                   FREE((caddr_t)ndp, M_NFSCLDELEG);
+                                   free(ndp, M_NFSCLDELEG);
                                    ndp = NULL;
                                    break;
                                }
@@ -2160,7 +2160,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *c
            ndp = TAILQ_NEXT(dp, nfsdl_list);
            if ((dp->nfsdl_flags & NFSCLDL_NEEDRECLAIM)) {
                if (nowp == NULL) {
-                   MALLOC(nowp, struct nfsclowner *,
+                   nowp = malloc(
                        sizeof (struct nfsclowner), M_NFSCLOWNER, M_WAITOK);
                    /*
                     * Name must be as long an largest possible
@@ -2176,7 +2176,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *c
                }
                nop = NULL;
                if (error != NFSERR_NOGRACE && error != NFSERR_BADSESSION) {
-                   MALLOC(nop, struct nfsclopen *, sizeof (struct nfsclopen) +
+                   nop = malloc(sizeof (struct nfsclopen) +
                        dp->nfsdl_fhlen - 1, M_NFSCLOPEN, M_WAITOK);
                    nop->nfso_own = nowp;
                    if ((dp->nfsdl_flags & NFSCLDL_WRITE)) {
@@ -2218,7 +2218,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *c
                            dp->nfsdl_flags &= ~NFSCLDL_NEEDRECLAIM;
                            if ((tdp->nfsdl_flags & NFSCLDL_RECALL))
                                dp->nfsdl_flags |= NFSCLDL_RECALL;
-                           FREE((caddr_t)tdp, M_NFSCLDELEG);
+                           free(tdp, M_NFSCLDELEG);
                        } else {
                            TAILQ_INSERT_HEAD(&extra_deleg, tdp, nfsdl_list);
                        }
@@ -2226,7 +2226,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *c
                }
                if (error) {
                    if (nop != NULL)
-                       FREE((caddr_t)nop, M_NFSCLOPEN);
+                       free(nop, M_NFSCLOPEN);
                    /*
                     * Couldn't reclaim it, so throw the state
                     * away. Ouch!!
@@ -2251,10 +2251,10 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *c
                                (void) nfs_catnap(PZERO, error, "nfsexcls");
                } while (error == NFSERR_GRACE);
                LIST_REMOVE(op, nfso_list);
-               FREE((caddr_t)op, M_NFSCLOPEN);
+               free(op, M_NFSCLOPEN);
        }
        if (nowp != NULL)
-               FREE((caddr_t)nowp, M_NFSCLOWNER);
+               free(nowp, M_NFSCLOWNER);
 
        TAILQ_FOREACH_SAFE(dp, &extra_deleg, nfsdl_list, ndp) {
                do {
@@ -2264,7 +2264,7 @@ nfscl_recover(struct nfsclclient *clp, struct ucred *c
                                (void) nfs_catnap(PZERO, error, "nfsexdlg");
                } while (error == NFSERR_GRACE);
                TAILQ_REMOVE(&extra_deleg, dp, nfsdl_list);
-               FREE((caddr_t)dp, M_NFSCLDELEG);
+               free(dp, M_NFSCLDELEG);
        }
 
        /* For NFSv4.1 or later, do a RECLAIM_COMPLETE. */
@@ -2795,7 +2795,7 @@ tryagain2:
                        newnfs_copycred(&dp->nfsdl_cred, cred);
                        (void) nfscl_trydelegreturn(dp, cred, clp->nfsc_nmp, p);
                        TAILQ_REMOVE(&dh, dp, nfsdl_list);
-                       FREE((caddr_t)dp, M_NFSCLDELEG);
+                       free(dp, M_NFSCLDELEG);
                }
 
                SLIST_INIT(&lfh);
@@ -3369,7 +3369,7 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p)
                        if (mp != NULL)
                                vfs_unbusy(mp);
                        if (nfhp != NULL)
-                               FREE((caddr_t)nfhp, M_NFSFH);
+                               free(nfhp, M_NFSFH);
                        if (!error)
                                (void) nfsv4_fillattr(nd, NULL, NULL, NULL, &va,
                                    NULL, 0, &rattrbits, NULL, p, 0, 0, 0, 0,
@@ -3409,7 +3409,7 @@ nfscl_docb(struct nfsrv_descript *nd, NFSPROC_T *p)
                                NFSUNLOCKCLSTATE();
                        }
                        if (nfhp != NULL)
-                               FREE((caddr_t)nfhp, M_NFSFH);
+                               free(nfhp, M_NFSFH);
                        break;
                case NFSV4OP_CBLAYOUTRECALL:
                        NFSCL_DEBUG(4, "cblayrec\n");
@@ -3977,7 +3977,7 @@ nfscl_recalldeleg(struct nfsclclient *clp, struct nfsm
                         * for it.
                         */
                        if (owp == NULL) {
-                               MALLOC(nowp, struct nfsclowner *,
+                               nowp = malloc(
                                    sizeof (struct nfsclowner), M_NFSCLOWNER,
                                    M_WAITOK);
                                nfscl_newopen(clp, NULL, &owp, &nowp, &op, 
@@ -4060,7 +4060,7 @@ nfscl_moveopen(vnode_t vp, struct nfsclclient *clp, st
 
        /* No appropriate open, so we have to do one against the server. */
        np = VTONFS(vp);
-       MALLOC(nop, struct nfsclopen *, sizeof (struct nfsclopen) +
+       nop = malloc(sizeof (struct nfsclopen) +
            lop->nfso_fhlen - 1, M_NFSCLOPEN, M_WAITOK);
        newone = 0;
        nfscl_newopen(clp, NULL, &owp, NULL, &op, &nop, owp->nfsow_owner,
@@ -4078,7 +4078,7 @@ nfscl_moveopen(vnode_t vp, struct nfsclclient *clp, st
                nfscl_freeopen(lop, 1);
        }
        if (nop != NULL)
-               FREE((caddr_t)nop, M_NFSCLOPEN);
+               free(nop, M_NFSCLOPEN);
        if (ndp != NULL) {
                /*
                 * What should I do with the returned delegation, since the
@@ -4086,7 +4086,7 @@ nfscl_moveopen(vnode_t vp, struct nfsclclient *clp, st
                 * through it away.
                 */
                printf("Moveopen returned deleg\n");
-               FREE((caddr_t)ndp, M_NFSCLDELEG);
+               free(ndp, M_NFSCLDELEG);
        }
        return (error);
 }

Modified: head/sys/fs/nfsclient/nfs_clsubs.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clsubs.c  Thu Jan 25 21:48:07 2018        
(r328416)
+++ head/sys/fs/nfsclient/nfs_clsubs.c  Thu Jan 25 22:25:13 2018        
(r328417)
@@ -278,7 +278,7 @@ ncl_getcookie(struct nfsnode *np, off_t off, int add)
        dp = LIST_FIRST(&np->n_cookies);
        if (!dp) {
                if (add) {
-                       MALLOC(dp, struct nfsdmap *, sizeof (struct nfsdmap),
+                       dp = malloc(sizeof (struct nfsdmap),
                                M_NFSDIROFF, M_WAITOK);
                        dp->ndm_eocookie = 0;
                        LIST_INSERT_HEAD(&np->n_cookies, dp, ndm_list);
@@ -293,7 +293,7 @@ ncl_getcookie(struct nfsnode *np, off_t off, int add)
                                goto out;
                        dp = LIST_NEXT(dp, ndm_list);
                } else if (add) {
-                       MALLOC(dp2, struct nfsdmap *, sizeof (struct nfsdmap),
+                       dp2 = malloc(sizeof (struct nfsdmap),
                                M_NFSDIROFF, M_WAITOK);
                        dp2->ndm_eocookie = 0;
                        LIST_INSERT_AFTER(dp, dp2, ndm_list);

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvfsops.c        Thu Jan 25 21:48:07 2018        
(r328416)
+++ head/sys/fs/nfsclient/nfs_clvfsops.c        Thu Jan 25 22:25:13 2018        
(r328417)
@@ -1392,10 +1392,10 @@ mountnfs(struct nfs_args *argp, struct mount *mp, stru
        if (mp->mnt_flag & MNT_UPDATE) {
                nmp = VFSTONFS(mp);
                printf("%s: MNT_UPDATE is no longer handled here\n", __func__);
-               FREE(nam, M_SONAME);
+               free(nam, M_SONAME);
                return (0);
        } else {
-               MALLOC(nmp, struct nfsmount *, sizeof (struct nfsmount) +
+               nmp = malloc(sizeof (struct nfsmount) +
                    krbnamelen + dirlen + srvkrbnamelen + 2,
                    M_NEWNFSMNT, M_WAITOK | M_ZERO);
                TAILQ_INIT(&nmp->nm_bufq);
@@ -1651,8 +1651,8 @@ bad:
                        newnfs_disconnect(dsp->nfsclds_sockp);
                nfscl_freenfsclds(dsp);
        }
-       FREE(nmp, M_NEWNFSMNT);
-       FREE(nam, M_SONAME);
+       free(nmp, M_NEWNFSMNT);
+       free(nam, M_SONAME);
        return (error);
 }
 
@@ -1728,7 +1728,7 @@ nfs_unmount(struct mount *mp, int mntflags)
 
        newnfs_disconnect(&nmp->nm_sockreq);
        crfree(nmp->nm_sockreq.nr_cred);
-       FREE(nmp->nm_nam, M_SONAME);
+       free(nmp->nm_nam, M_SONAME);
        if (nmp->nm_sockreq.nr_auth != NULL)
                AUTH_DESTROY(nmp->nm_sockreq.nr_auth);
        mtx_destroy(&nmp->nm_sockreq.nr_mtx);
@@ -1739,7 +1739,7 @@ nfs_unmount(struct mount *mp, int mntflags)
                        newnfs_disconnect(dsp->nfsclds_sockp);
                nfscl_freenfsclds(dsp);
        }
-       FREE(nmp, M_NEWNFSMNT);
+       free(nmp, M_NEWNFSMNT);
 out:
        return (error);
 }

Modified: head/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvnops.c Thu Jan 25 21:48:07 2018        
(r328416)
+++ head/sys/fs/nfsclient/nfs_clvnops.c Thu Jan 25 22:25:13 2018        
(r328417)
@@ -1193,7 +1193,7 @@ nfs_lookup(struct vop_lookup_args *ap)
         */
        if (cnp->cn_nameiop == RENAME && (flags & ISLASTCN)) {
                if (NFS_CMPFH(np, nfhp->nfh_fh, nfhp->nfh_len)) {
-                       FREE((caddr_t)nfhp, M_NFSFH);
+                       free(nfhp, M_NFSFH);
                        return (EISDIR);
                }
                error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL,
@@ -1248,7 +1248,7 @@ nfs_lookup(struct vop_lookup_args *ap)
                        (void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
                            0, 1);
        } else if (NFS_CMPFH(np, nfhp->nfh_fh, nfhp->nfh_len)) {
-               FREE((caddr_t)nfhp, M_NFSFH);
+               free(nfhp, M_NFSFH);
                VREF(dvp);
                newvp = dvp;
                if (attrflag)
@@ -1817,7 +1817,7 @@ nfs_rename(struct vop_rename_args *ap)
                 * For NFSv4, check to see if it is the same name and
                 * replace the name, if it is different.
                 */
-               MALLOC(newv4, struct nfsv4node *,
+               newv4 = malloc(
                    sizeof (struct nfsv4node) +
                    tdnp->n_fhp->nfh_len + tcnp->cn_namelen - 1,
                    M_NFSV4NODE, M_WAITOK);
@@ -1838,7 +1838,7 @@ nnn[nnnl] = '\0';
 printf("ren replace=%s\n",nnn);
 }
 #endif
-                       FREE((caddr_t)fnp->n_v4, M_NFSV4NODE);
+                       free(fnp->n_v4, M_NFSV4NODE);
                        fnp->n_v4 = newv4;
                        newv4 = NULL;
                        fnp->n_v4->n4_fhlen = tdnp->n_fhp->nfh_len;
@@ -1851,7 +1851,7 @@ printf("ren replace=%s\n",nnn);
                mtx_unlock(&tdnp->n_mtx);
                mtx_unlock(&fnp->n_mtx);
                if (newv4 != NULL)
-                       FREE((caddr_t)newv4, M_NFSV4NODE);
+                       free(newv4, M_NFSV4NODE);
        }
 
        if (fvp->v_type == VDIR) {
@@ -2389,7 +2389,7 @@ nfs_sillyrename(struct vnode *dvp, struct vnode *vp, s
        cache_purge(dvp);
        np = VTONFS(vp);
        KASSERT(vp->v_type != VDIR, ("nfs: sillyrename dir"));
-       MALLOC(sp, struct sillyrename *, sizeof (struct sillyrename),
+       sp = malloc(sizeof (struct sillyrename),
            M_NEWNFSREQ, M_WAITOK);
        sp->s_cred = crhold(cnp->cn_cred);
        sp->s_dvp = dvp;
@@ -2423,7 +2423,7 @@ nfs_sillyrename(struct vnode *dvp, struct vnode *vp, s
 bad:
        vrele(sp->s_dvp);
        crfree(sp->s_cred);
-       free((caddr_t)sp, M_NEWNFSREQ);
+       free(sp, M_NEWNFSREQ);
        return (error);
 }
 
@@ -2473,8 +2473,8 @@ nnn[nnnl] = '\0';
 printf("replace=%s\n",nnn);
 }
 #endif
-                           FREE((caddr_t)np->n_v4, M_NFSV4NODE);
-                           MALLOC(np->n_v4, struct nfsv4node *,
+                           free(np->n_v4, M_NFSV4NODE);
+                           np->n_v4 = malloc(
                                sizeof (struct nfsv4node) +
                                dnp->n_fhp->nfh_len + len - 1,
                                M_NFSV4NODE, M_WAITOK);
@@ -2493,10 +2493,10 @@ printf("replace=%s\n",nnn);
                    vfs_hash_rehash(vp, hash);
                    np->n_fhp = nfhp;
                    if (onfhp != NULL)
-                       FREE((caddr_t)onfhp, M_NFSFH);
+                       free(onfhp, M_NFSFH);
                    newvp = NFSTOV(np);
                } else if (NFS_CMPFH(dnp, nfhp->nfh_fh, nfhp->nfh_len)) {
-                   FREE((caddr_t)nfhp, M_NFSFH);
+                   free(nfhp, M_NFSFH);
                    VREF(dvp);
                    newvp = dvp;
                } else {

Modified: head/sys/fs/nfsclient/nfsnode.h
==============================================================================
--- head/sys/fs/nfsclient/nfsnode.h     Thu Jan 25 21:48:07 2018        
(r328416)
+++ head/sys/fs/nfsclient/nfsnode.h     Thu Jan 25 22:25:13 2018        
(r328417)
@@ -87,7 +87,7 @@ struct nfs_accesscache {
  * An nfsnode is 'named' by its file handle. (nget/nfs_node.c)
  * If this structure exceeds 256 bytes (it is currently 256 using 4.4BSD-Lite
  * type definitions), file handles of > 32 bytes should probably be split out
- * into a separate MALLOC()'d data structure. (Reduce the size of nfsfh_t by
+ * into a separate malloc()'d data structure. (Reduce the size of nfsfh_t by
  * changing the definition in nfsproto.h of NFS_SMALLFH.)
  * NB: Hopefully the current order of the fields is such that everything will
  *     be well aligned and, therefore, tightly packed.

Modified: head/sys/fs/nfsserver/nfs_nfsdcache.c
==============================================================================
--- head/sys/fs/nfsserver/nfs_nfsdcache.c       Thu Jan 25 21:48:07 2018        
(r328416)
+++ head/sys/fs/nfsserver/nfs_nfsdcache.c       Thu Jan 25 22:25:13 2018        
(r328417)
@@ -336,7 +336,7 @@ nfsrvd_getcache(struct nfsrv_descript *nd)
 
        if (nd->nd_procnum == NFSPROC_NULL)
                panic("nfsd cache null");
-       MALLOC(newrp, struct nfsrvcache *, sizeof (struct nfsrvcache),
+       newrp = malloc(sizeof (struct nfsrvcache),
            M_NFSRVCACHE, M_WAITOK);
        NFSBZERO((caddr_t)newrp, sizeof (struct nfsrvcache));
        if (nd->nd_flag & ND_NFSV4)
@@ -423,7 +423,7 @@ loop:
                                panic("nfs udp cache1");
                        }
                        nfsrc_unlock(rp);
-                       free((caddr_t)newrp, M_NFSRVCACHE);
+                       free(newrp, M_NFSRVCACHE);
                        goto out;
                }
        }
@@ -710,7 +710,7 @@ tryagain:
                        panic("nfs tcp cache1");
                }
                nfsrc_unlock(rp);
-               free((caddr_t)newrp, M_NFSRVCACHE);
+               free(newrp, M_NFSRVCACHE);
                goto out;
        }
        nfsstatsv1.srvcache_misses++;
@@ -802,7 +802,7 @@ nfsrc_freecache(struct nfsrvcache *rp)
                if (!(rp->rc_flag & RC_UDP))
                        atomic_add_int(&nfsrc_tcpsavedreplies, -1);
        }
-       FREE((caddr_t)rp, M_NFSRVCACHE);
+       free(rp, M_NFSRVCACHE);
        atomic_add_int(&nfsstatsv1.srvcache_size, -1);
 }
 

Modified: head/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- head/sys/fs/nfsserver/nfs_nfsdport.c        Thu Jan 25 21:48:07 2018        
(r328416)
+++ head/sys/fs/nfsserver/nfs_nfsdport.c        Thu Jan 25 22:25:13 2018        
(r328417)
@@ -659,7 +659,7 @@ nfsvno_read(struct vnode *vp, off_t off, int cnt, stru
                        m3 = m;
                m2 = m;
        }
-       MALLOC(iv, struct iovec *, i * sizeof (struct iovec),
+       iv = malloc(i * sizeof (struct iovec),
            M_TEMP, M_WAITOK);
        uiop->uio_iov = iv2 = iv;
        m = m3;
@@ -690,7 +690,7 @@ nfsvno_read(struct vnode *vp, off_t off, int cnt, stru
        /* XXX KDM make this more systematic? */
        nfsstatsv1.srvbytes[NFSV4OP_READ] += uiop->uio_resid;
        error = VOP_READ(vp, uiop, IO_NODELOCKED | ioflag, cred);
-       FREE((caddr_t)iv2, M_TEMP);
+       free(iv2, M_TEMP);
        if (error) {
                m_freem(m3);
                *mpp = NULL;
@@ -727,7 +727,7 @@ nfsvno_write(struct vnode *vp, off_t off, int retlen, 
        struct uio io, *uiop = &io;
        struct nfsheur *nh;
 
-       MALLOC(ivp, struct iovec *, cnt * sizeof (struct iovec), M_TEMP,
+       ivp = malloc(cnt * sizeof (struct iovec), M_TEMP,
            M_WAITOK);
        uiop->uio_iov = iv = ivp;
        uiop->uio_iovcnt = cnt;
@@ -766,7 +766,7 @@ nfsvno_write(struct vnode *vp, off_t off, int retlen, 
        error = VOP_WRITE(vp, uiop, ioflags, cred);
        if (error == 0)
                nh->nh_nextoff = uiop->uio_offset;
-       FREE((caddr_t)iv, M_TEMP);
+       free(iv, M_TEMP);
 
        NFSEXITCODE(error);
        return (error);
@@ -1004,7 +1004,7 @@ out:
 
 /*
  * Parse symbolic link arguments.
- * This function has an ugly side effect. It will MALLOC() an area for
+ * This function has an ugly side effect. It will malloc() an area for
  * the symlink and set iov_base to point to it, only if it succeeds.
  * So, if it returns with uiop->uio_iov->iov_base != NULL, that must
  * be FREE'd later.
@@ -1029,7 +1029,7 @@ nfsvno_getsymlink(struct nfsrv_descript *nd, struct nf
                error = EBADRPC;
                goto nfsmout;
        }
-       MALLOC(pathcp, caddr_t, len + 1, M_TEMP, M_WAITOK);
+       pathcp = malloc(len + 1, M_TEMP, M_WAITOK);
        error = nfsrv_mtostr(nd, pathcp, len);
        if (error)
                goto nfsmout;
@@ -1634,11 +1634,11 @@ nfsrvd_readdir(struct nfsrv_descript *nd, int isdgram,
                goto out;
        }
        is_ufs = strcmp(vp->v_mount->mnt_vfc->vfc_name, "ufs") == 0;
-       MALLOC(rbuf, caddr_t, siz, M_TEMP, M_WAITOK);
+       rbuf = malloc(siz, M_TEMP, M_WAITOK);
 again:
        eofflag = 0;
        if (cookies) {
-               free((caddr_t)cookies, M_TEMP);
+               free(cookies, M_TEMP);
                cookies = NULL;
        }
 
@@ -1670,9 +1670,9 @@ again:
         */
        if (nd->nd_repstat) {
                vput(vp);
-               free((caddr_t)rbuf, M_TEMP);
+               free(rbuf, M_TEMP);
                if (cookies)
-                       free((caddr_t)cookies, M_TEMP);
+                       free(cookies, M_TEMP);
                if (nd->nd_flag & ND_NFSV3)
                        nfsrv_postopattr(nd, getret, &at);
                goto out;
@@ -1693,8 +1693,8 @@ again:

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to