git: 2f9116e4804d - stable/13 - fd: Initialize more export_fd_buf fields in kern_proc_cwd_out()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 31 Dec 2021 14:26:21 UTC
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=2f9116e4804d6332c85ee6cd362263594b2d5680

commit 2f9116e4804d6332c85ee6cd362263594b2d5680
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-12-16 21:53:59 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-12-31 14:26:07 +0000

    fd: Initialize more export_fd_buf fields in kern_proc_cwd_out()
    
    In particular, we need to initialize efbuf->flags, since
    export_vnode_to_sb() loads that field.  This was mostly harmless since
    the flag only determines whether the output kinfo_file is packed, and
    KERN_PROC_CWD only ever emits a single kinfo_file anyway.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 327060bd7799e5d4376693fba770a17b79e5a38d)
---
 sys/kern/kern_descrip.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index a8952a5e1595..651a992b0e02 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -4748,9 +4748,11 @@ kern_proc_cwd_out(struct proc *p,  struct sbuf *sb, ssize_t maxlen)
 		return (EINVAL);
 
 	efbuf = malloc(sizeof(*efbuf), M_TEMP, M_WAITOK);
+	efbuf->fdp = NULL;
 	efbuf->pdp = pdp;
 	efbuf->sb = sb;
 	efbuf->remainder = maxlen;
+	efbuf->flags = 0;
 
 	PWDDESC_XLOCK(pdp);
 	pwd = PWDDESC_XLOCKED_LOAD_PWD(pdp);