From e3fc28d3eb996a1117d17bd2c4ca3547140e1a09 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Wed, 5 Apr 2017 04:00:42 +0000 Subject: 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'; -- cgit v1.2.3