summaryrefslogtreecommitdiff
path: root/sys/kern/sysv_shm.c
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2007-09-07 15:00:21 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2007-09-07 15:00:21 +0000
commit85ce33f47337d8ae2200b69c865bad9704a53564 (patch)
tree45c03da13cdd18d57180b1614667ab28a7a26012 /sys/kern/sysv_shm.c
parent27eb8946aec561bdd8abb9e09db43d6f4093d59a (diff)
Use M_ZERO in a few more places to shave bytes from the kernel.
eyeballed and ok dlg@
Diffstat (limited to 'sys/kern/sysv_shm.c')
-rw-r--r--sys/kern/sysv_shm.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/sys/kern/sysv_shm.c b/sys/kern/sysv_shm.c
index 4475cc91d9e..538f530efaf 100644
--- a/sys/kern/sysv_shm.c
+++ b/sys/kern/sysv_shm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysv_shm.c,v 1.47 2007/05/29 10:44:28 sturm Exp $ */
+/* $OpenBSD: sysv_shm.c,v 1.48 2007/09/07 15:00:20 art Exp $ */
/* $NetBSD: sysv_shm.c,v 1.50 1998/10/21 22:24:29 tron Exp $ */
/*
@@ -535,11 +535,9 @@ shminit(void)
sizeof(struct shm_handle), 0, 0, 0, "shmpl",
&pool_allocator_nointr);
shmsegs = malloc(shminfo.shmmni * sizeof(struct shmid_ds *),
- M_SHM, M_WAITOK);
- bzero(shmsegs, shminfo.shmmni * sizeof(struct shmid_ds *));
+ M_SHM, M_WAITOK|M_ZERO);
shmseqs = malloc(shminfo.shmmni * sizeof(unsigned short),
- M_SHM, M_WAITOK);
- bzero(shmseqs, shminfo.shmmni * sizeof(unsigned short));
+ M_SHM, M_WAITOK|M_ZERO);
shminfo.shmmax *= PAGE_SIZE; /* actually in pages */
shm_last_free = 0;
@@ -601,18 +599,15 @@ sysctl_sysvshm(int *name, u_int namelen, void *oldp, size_t *oldlenp,
/* Expand shmsegs and shmseqs arrays */
newsegs = malloc(val * sizeof(struct shmid_ds *),
- M_SHM, M_WAITOK);
+ M_SHM, M_WAITOK|M_ZERO);
bcopy(shmsegs, newsegs,
shminfo.shmmni * sizeof(struct shmid_ds *));
- bzero(newsegs + shminfo.shmmni,
- (val - shminfo.shmmni) * sizeof(struct shmid_ds *));
free(shmsegs, M_SHM);
shmsegs = newsegs;
- newseqs = malloc(val * sizeof(unsigned short), M_SHM, M_WAITOK);
+ newseqs = malloc(val * sizeof(unsigned short), M_SHM,
+ M_WAITOK|M_ZERO);
bcopy(shmseqs, newseqs,
shminfo.shmmni * sizeof(unsigned short));
- bzero(newseqs + shminfo.shmmni,
- (val - shminfo.shmmni) * sizeof(unsigned short));
free(shmseqs, M_SHM);
shmseqs = newseqs;
shminfo.shmmni = val;