git: 327060bd7799 - main - fd: Initialize more export_fd_buf fields in kern_proc_cwd_out()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 17 Dec 2021 18:11:50 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=327060bd7799e5d4376693fba770a17b79e5a38d

commit 327060bd7799e5d4376693fba770a17b79e5a38d
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-12-16 21:53:59 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-12-17 18:10:22 +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.
    
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation
---
 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 03cc77ff31ba..fb2dc4fdc94e 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -4660,9 +4660,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);