From 7a9bc8a82ec20f9208643f1615ea4ca1d0e5d933 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Thu, 15 Jul 2021 22:39:27 -0400 Subject: [PATCH] nfssvc: Zero the buffer copied out when NFSSVC_DUMPMNTOPTS is set Reported by: KMSAN MFC after: 1 week Sponsored by: The FreeBSD Foundation --- sys/fs/nfsclient/nfs_clport.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c index 90d403334155..5c79e3ac6960 100644 --- a/sys/fs/nfsclient/nfs_clport.c +++ b/sys/fs/nfsclient/nfs_clport.c @@ -1312,7 +1312,8 @@ nfssvc_nfscl(struct thread *td, struct nfssvc_args *uap) error = EINVAL; } if (error == 0) { - buf = malloc(dumpmntopts.ndmnt_blen, M_TEMP, M_WAITOK); + buf = malloc(dumpmntopts.ndmnt_blen, M_TEMP, M_WAITOK | + M_ZERO); nfscl_retopts(VFSTONFS(nd.ni_vp->v_mount), buf, dumpmntopts.ndmnt_blen); vput(nd.ni_vp);