From 687e82acc7e04b808810c63c0f83c725475eb4b2 Mon Sep 17 00:00:00 2001 From: deraadt Date: Wed, 5 Apr 2017 04:00:41 +0000 Subject: [PATCH] Here at OpenBSD we change ABIs at the fling of a hat. Just in case a future disk info sysctl has pads in the structures, use M_ZERO when allocating the storage to avoid leaking kernel memory. --- sys/kern/kern_sysctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 7b6d3beb32e..cb38823cfd0 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.322 2017/03/07 09:29:40 mpi Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.323 2017/04/05 04:00:41 deraadt Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -2088,9 +2088,9 @@ sysctl_diskinit(int update, struct proc *p) diskstats = NULL; disknames = NULL; diskstats = mallocarray(disk_count, sizeof(struct diskstats), - M_SYSCTL, M_WAITOK); + M_SYSCTL, M_WAITOK|M_ZERO); diskstatslen = disk_count * sizeof(struct diskstats); - disknames = malloc(tlen, M_SYSCTL, M_WAITOK); + disknames = malloc(tlen, M_SYSCTL, M_WAITOK|M_ZERO); disknameslen = tlen; disknames[0] = '\0'; -- 2.20.1