git: abf6f5aaed28 - stable/15 - devstat: Fix a kernel stack disclosure

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Wed, 02 Sep 2026 22:40:48 UTC
The branch stable/15 has been updated by markj:

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

commit abf6f5aaed283a1cc23e5c4f6296c716c6863bce
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-09-01 16:07:09 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-09-02 17:40:37 +0000

    devstat: Fix a kernel stack disclosure
    
    The 16-byte "device_name" field was not zero-filled, so could contain
    uninitialized stack data.  Zero the whole struct, as that's the
    prevailing pattern for this kind of conversion code, and it's more
    robust in the face of future revisions to struct devstat.
    
    Reviewed by:    olce, kib
    Reported by:    Reo Shiseki
    Fixes:          a11d132f6c62 ("devstat: Provide 32-bit compatibility")
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D59309
    
    (cherry picked from commit 7cb1a76f88158fb690418336b736e66c238cd4f7)
---
 sys/kern/subr_devstat.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/kern/subr_devstat.c b/sys/kern/subr_devstat.c
index c62df0e210e1..b0f2a5d8cbf1 100644
--- a/sys/kern/subr_devstat.c
+++ b/sys/kern/subr_devstat.c
@@ -430,6 +430,7 @@ sysctl_devstat(SYSCTL_HANDLER_ARGS)
 			struct devstat32 ds32;
 			unsigned int i;
 
+			memset(&ds32, 0, sizeof(ds32));
 			CP(*nds, ds32, sequence0);
 			CP(*nds, ds32, allocated);
 			CP(*nds, ds32, start_count);