diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2017-04-05 04:00:42 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2017-04-05 04:00:42 +0000 |
commit | e3fc28d3eb996a1117d17bd2c4ca3547140e1a09 (patch) | |
tree | 4117cb6943495e09c89d97942a2d96594cb4fe96 | |
parent | 7b12819118d40eeb290318f11f0fedb9a1447f2f (diff) |
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.
-rw-r--r-- | sys/kern/kern_sysctl.c | 6 |
1 files 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'; |