View | Details | Raw Unified | Return to bug 22168
Collapse All | Expand All

(-)kern_descrip.c (-4 / +2 lines)
Lines 770-777 Link Here
770
	 * the list of open files.
770
	 * the list of open files.
771
	 */
771
	 */
772
	nfiles++;
772
	nfiles++;
773
	MALLOC(fp, struct file *, sizeof(struct file), M_FILE, M_WAITOK);
773
	MALLOC(fp, struct file *, sizeof(struct file), M_FILE, M_WAITOK | M_ZERO);
774
	bzero(fp, sizeof(struct file));
775
	fp->f_count = 1;
774
	fp->f_count = 1;
776
	fp->f_cred = p->p_ucred;
775
	fp->f_cred = p->p_ucred;
777
	fp->f_ops = &badfileops;
776
	fp->f_ops = &badfileops;
Lines 817-824 Link Here
817
	register struct filedesc *fdp = p->p_fd;
816
	register struct filedesc *fdp = p->p_fd;
818
817
819
	MALLOC(newfdp, struct filedesc0 *, sizeof(struct filedesc0),
818
	MALLOC(newfdp, struct filedesc0 *, sizeof(struct filedesc0),
820
	    M_FILEDESC, M_WAITOK);
819
	    M_FILEDESC, M_WAITOK | M_ZERO);
821
	bzero(newfdp, sizeof(struct filedesc0));
822
	newfdp->fd_fd.fd_cdir = fdp->fd_cdir;
820
	newfdp->fd_fd.fd_cdir = fdp->fd_cdir;
823
	if (newfdp->fd_fd.fd_cdir)
821
	if (newfdp->fd_fd.fd_cdir)
824
		VREF(newfdp->fd_fd.fd_cdir);
822
		VREF(newfdp->fd_fd.fd_cdir);
(-)kern_event.c (-2 / +1 lines)
Lines 306-313 Link Here
306
	fp->f_flag = FREAD | FWRITE;
306
	fp->f_flag = FREAD | FWRITE;
307
	fp->f_type = DTYPE_KQUEUE;
307
	fp->f_type = DTYPE_KQUEUE;
308
	fp->f_ops = &kqueueops;
308
	fp->f_ops = &kqueueops;
309
	kq = malloc(sizeof(struct kqueue), M_TEMP, M_WAITOK);
309
	kq = malloc(sizeof(struct kqueue), M_TEMP, M_WAITOK | M_ZERO);
310
	bzero(kq, sizeof(*kq));
311
	TAILQ_INIT(&kq->kq_head);
310
	TAILQ_INIT(&kq->kq_head);
312
	fp->f_data = (caddr_t)kq;
311
	fp->f_data = (caddr_t)kq;
313
	p->p_retval[0] = fd;
312
	p->p_retval[0] = fd;
(-)kern_jail.c (-2 / +1 lines)
Lines 59-66 Link Here
59
		return (error);
59
		return (error);
60
	if (j.version != 0)
60
	if (j.version != 0)
61
		return (EINVAL);
61
		return (EINVAL);
62
	MALLOC(pr, struct prison *, sizeof *pr , M_PRISON, M_WAITOK);
62
	MALLOC(pr, struct prison *, sizeof *pr , M_PRISON, M_WAITOK | M_ZERO);
63
	bzero((caddr_t)pr, sizeof *pr);
64
	error = copyinstr(j.hostname, &pr->pr_host, sizeof pr->pr_host, 0);
63
	error = copyinstr(j.hostname, &pr->pr_host, sizeof pr->pr_host, 0);
65
	if (error) 
64
	if (error) 
66
		goto bail;
65
		goto bail;
(-)kern_linker.c (-4 / +2 lines)
Lines 515-524 Link Here
515
    linker_file_t* newdeps;
515
    linker_file_t* newdeps;
516
516
517
    newdeps = malloc((file->ndeps + 1) * sizeof(linker_file_t*),
517
    newdeps = malloc((file->ndeps + 1) * sizeof(linker_file_t*),
518
		     M_LINKER, M_WAITOK);
518
		     M_LINKER, M_WAITOK | M_ZERO);
519
    if (newdeps == NULL)
519
    if (newdeps == NULL)
520
	return ENOMEM;
520
	return ENOMEM;
521
    bzero(newdeps, (file->ndeps + 1) * sizeof(linker_file_t*));
522
521
523
    if (file->deps) {
522
    if (file->deps) {
524
	bcopy(file->deps, newdeps, file->ndeps * sizeof(linker_file_t*));
523
	bcopy(file->deps, newdeps, file->ndeps * sizeof(linker_file_t*));
Lines 589-600 Link Here
589
	cp = malloc(sizeof(struct common_symbol)
588
	cp = malloc(sizeof(struct common_symbol)
590
		    + common_size
589
		    + common_size
591
		    + strlen(name) + 1,
590
		    + strlen(name) + 1,
592
		    M_LINKER, M_WAITOK);
591
		    M_LINKER, M_WAITOK | M_ZERO);
593
	if (!cp) {
592
	if (!cp) {
594
	    KLD_DPF(SYM, ("linker_file_lookup_symbol: nomem\n"));
593
	    KLD_DPF(SYM, ("linker_file_lookup_symbol: nomem\n"));
595
	    return 0;
594
	    return 0;
596
	}
595
	}
597
	bzero(cp, sizeof(struct common_symbol) + common_size + strlen(name)+ 1);
598
596
599
	cp->address = (caddr_t) (cp + 1);
597
	cp->address = (caddr_t) (cp + 1);
600
	cp->name = cp->address + common_size;
598
	cp->name = cp->address + common_size;
(-)kern_prot.c (-2 / +1 lines)
Lines 1136-1143 Link Here
1136
{
1136
{
1137
	register struct ucred *cr;
1137
	register struct ucred *cr;
1138
1138
1139
	MALLOC(cr, struct ucred *, sizeof(*cr), M_CRED, M_WAITOK);
1139
	MALLOC(cr, struct ucred *, sizeof(*cr), M_CRED, M_WAITOK | M_ZERO);
1140
	bzero((caddr_t)cr, sizeof(*cr));
1141
	cr->cr_ref = 1;
1140
	cr->cr_ref = 1;
1142
	return (cr);
1141
	return (cr);
1143
}
1142
}
(-)kern_sysctl.c (-2 / +1 lines)
Lines 339-346 Link Here
339
			return (NULL);
339
			return (NULL);
340
		}
340
		}
341
	}
341
	}
342
	oidp = malloc(sizeof(struct sysctl_oid), M_SYSCTLOID, M_WAITOK);
342
	oidp = malloc(sizeof(struct sysctl_oid), M_SYSCTLOID, M_WAITOK | M_ZERO);
343
	bzero(oidp, sizeof(struct sysctl_oid));
344
	oidp->oid_parent = parent;
343
	oidp->oid_parent = parent;
345
	SLIST_NEXT(oidp, oid_link) = NULL;
344
	SLIST_NEXT(oidp, oid_link) = NULL;
346
	oidp->oid_number = number;
345
	oidp->oid_number = number;
(-)link_elf.c (-2 / +1 lines)
Lines 728-739 Link Here
728
    nbytes = hdr->e_shnum * hdr->e_shentsize;
728
    nbytes = hdr->e_shnum * hdr->e_shentsize;
729
    if (nbytes == 0 || hdr->e_shoff == 0)
729
    if (nbytes == 0 || hdr->e_shoff == 0)
730
	goto nosyms;
730
	goto nosyms;
731
    shdr = malloc(nbytes, M_LINKER, M_WAITOK);
731
    shdr = malloc(nbytes, M_LINKER, M_WAITOK | M_ZERO);
732
    if (shdr == NULL) {
732
    if (shdr == NULL) {
733
	error = ENOMEM;
733
	error = ENOMEM;
734
	goto out;
734
	goto out;
735
    }
735
    }
736
    bzero(shdr, nbytes);
737
    error = vn_rdwr(UIO_READ, nd.ni_vp,
736
    error = vn_rdwr(UIO_READ, nd.ni_vp,
738
		    (caddr_t)shdr, nbytes, hdr->e_shoff,
737
		    (caddr_t)shdr, nbytes, hdr->e_shoff,
739
		    UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, p);
738
		    UIO_SYSSPACE, IO_NODELOCKED, p->p_ucred, &resid, p);
(-)subr_blist.c (-3 / +1 lines)
Lines 152-160 Link Here
152
		skip = (skip + 1) << BLIST_META_RADIX_SHIFT;
152
		skip = (skip + 1) << BLIST_META_RADIX_SHIFT;
153
	}
153
	}
154
154
155
	bl = malloc(sizeof(struct blist), M_SWAP, M_WAITOK);
155
	bl = malloc(sizeof(struct blist), M_SWAP, M_WAITOK | M_ZERO);
156
157
	bzero(bl, sizeof(*bl));
158
156
159
	bl->bl_blocks = blocks;
157
	bl->bl_blocks = blocks;
160
	bl->bl_radix = radix;
158
	bl->bl_radix = radix;
(-)tty.c (-2 / +1 lines)
Lines 2402-2409 Link Here
2402
2402
2403
	if (tp)
2403
	if (tp)
2404
		return(tp);
2404
		return(tp);
2405
        tp = malloc(sizeof *tp, M_TTYS, M_WAITOK);
2405
        tp = malloc(sizeof *tp, M_TTYS, M_WAITOK | M_ZERO);
2406
        bzero(tp, sizeof *tp);
2407
	ttyregister(tp);
2406
	ttyregister(tp);
2408
        return (tp);
2407
        return (tp);
2409
}
2408
}
(-)tty_pty.c (-2 / +1 lines)
Lines 147-154 Link Here
147
	if (n & ~0xff)
147
	if (n & ~0xff)
148
		return (NODEV);
148
		return (NODEV);
149
149
150
	pt = malloc(sizeof(*pt), M_PTY, M_WAITOK);
150
	pt = malloc(sizeof(*pt), M_PTY, M_WAITOK | M_ZERO);
151
	bzero(pt, sizeof(*pt));
152
	pt->devs = devs = make_dev(&pts_cdevsw, n,
151
	pt->devs = devs = make_dev(&pts_cdevsw, n,
153
	    UID_ROOT, GID_WHEEL, 0666, "tty%c%r", names[n / 32], n % 32);
152
	    UID_ROOT, GID_WHEEL, 0666, "tty%c%r", names[n / 32], n % 32);
154
	pt->devc = devc = make_dev(&ptc_cdevsw, n,
153
	pt->devc = devc = make_dev(&ptc_cdevsw, n,
(-)tty_snoop.c (-2 / +1 lines)
Lines 292-299 Link Here
292
	if (dev->si_drv1 == NULL) {
292
	if (dev->si_drv1 == NULL) {
293
		int mynor = minor(dev);
293
		int mynor = minor(dev);
294
294
295
		dev->si_drv1 = snp = malloc(sizeof(*snp), M_SNP, M_WAITOK);
295
		dev->si_drv1 = snp = malloc(sizeof(*snp), M_SNP, M_WAITOK | M_ZERO);
296
		bzero(snp, sizeof(*snp));
297
		make_dev(&snp_cdevsw, mynor, 0, 0, 0600, "snp%d", mynor);
296
		make_dev(&snp_cdevsw, mynor, 0, 0, 0600, "snp%d", mynor);
298
	} else
297
	} else
299
		return (EBUSY);
298
		return (EBUSY);
(-)uipc_socket.c (-4 / +2 lines)
Lines 1038-1045 Link Here
1038
		error = ENOENT;
1038
		error = ENOENT;
1039
		goto out;
1039
		goto out;
1040
	}
1040
	}
1041
	MALLOC(af, struct so_accf *, sizeof(*af), M_ACCF, M_WAITOK);
1041
	MALLOC(af, struct so_accf *, sizeof(*af), M_ACCF, M_WAITOK | M_ZERO);
1042
	bzero(af, sizeof(*af));
1043
	if (afp->accf_create != NULL) {
1042
	if (afp->accf_create != NULL) {
1044
		if (afap->af_name[0] != '\0') {
1043
		if (afap->af_name[0] != '\0') {
1045
			int len = strlen(afap->af_name) + 1;
1044
			int len = strlen(afap->af_name) + 1;
Lines 1298-1305 Link Here
1298
			if ((so->so_options & SO_ACCEPTCONN) == 0)
1297
			if ((so->so_options & SO_ACCEPTCONN) == 0)
1299
				return (EINVAL);
1298
				return (EINVAL);
1300
			MALLOC(afap, struct accept_filter_arg *, sizeof(*afap),
1299
			MALLOC(afap, struct accept_filter_arg *, sizeof(*afap),
1301
				M_TEMP, M_WAITOK);
1300
				M_TEMP, M_WAITOK | M_ZERO);
1302
			bzero(afap, sizeof(*afap));
1303
			if ((so->so_options & SO_ACCEPTFILTER) != 0) {
1301
			if ((so->so_options & SO_ACCEPTFILTER) != 0) {
1304
				strcpy(afap->af_name, so->so_accf->so_accept_filter->accf_name);
1302
				strcpy(afap->af_name, so->so_accf->so_accept_filter->accf_name);
1305
				if (so->so_accf->so_accept_filter_str != NULL)
1303
				if (so->so_accf->so_accept_filter_str != NULL)
(-)vfs_cache.c (-2 / +1 lines)
Lines 299-306 Link Here
299
	}
299
	}
300
	 
300
	 
301
	ncp = (struct namecache *)
301
	ncp = (struct namecache *)
302
		malloc(sizeof *ncp + cnp->cn_namelen, M_VFSCACHE, M_WAITOK);
302
		malloc(sizeof *ncp + cnp->cn_namelen, M_VFSCACHE, M_WAITOK | M_ZERO);
303
	bzero((char *)ncp, sizeof *ncp);
304
	numcache++;
303
	numcache++;
305
	if (!vp) {
304
	if (!vp) {
306
		numneg++;
305
		numneg++;
(-)vfs_init.c (-2 / +1 lines)
Lines 125-134 Link Here
125
		if (*opv_desc_vector_p)
125
		if (*opv_desc_vector_p)
126
			FREE(*opv_desc_vector_p, M_VNODE);
126
			FREE(*opv_desc_vector_p, M_VNODE);
127
		MALLOC(*opv_desc_vector_p, vop_t **,
127
		MALLOC(*opv_desc_vector_p, vop_t **,
128
		       vfs_opv_numops * sizeof(vop_t *), M_VNODE, M_WAITOK);
128
		       vfs_opv_numops * sizeof(vop_t *), M_VNODE, M_WAITOK | M_ZERO);
129
		if (*opv_desc_vector_p == NULL)
129
		if (*opv_desc_vector_p == NULL)
130
			panic("no memory for vop_t ** vector");
130
			panic("no memory for vop_t ** vector");
131
		bzero(*opv_desc_vector_p, vfs_opv_numops * sizeof(vop_t *));
132
131
133
		/* Fill in, with slot 0 being to return EOPNOTSUPP */
132
		/* Fill in, with slot 0 being to return EOPNOTSUPP */
134
		opv_desc_vector = *opv_desc_vector_p;
133
		opv_desc_vector = *opv_desc_vector_p;
(-)vfs_subr.c (-4 / +2 lines)
Lines 339-346 Link Here
339
			break;
339
			break;
340
	if (vfsp == NULL)
340
	if (vfsp == NULL)
341
		return (ENODEV);
341
		return (ENODEV);
342
	mp = malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK);
342
	mp = malloc((u_long)sizeof(struct mount), M_MOUNT, M_WAITOK | M_ZERO);
343
	bzero((char *)mp, (u_long)sizeof(struct mount));
344
	lockinit(&mp->mnt_lock, PVFS, "vfslock", 0, LK_NOPAUSE);
343
	lockinit(&mp->mnt_lock, PVFS, "vfslock", 0, LK_NOPAUSE);
345
	(void)vfs_busy(mp, LK_NOWAIT, 0, p);
344
	(void)vfs_busy(mp, LK_NOWAIT, 0, p);
346
	LIST_INIT(&mp->mnt_vnodelist);
345
	LIST_INIT(&mp->mnt_vnodelist);
Lines 2320-2327 Link Here
2320
		return (0);
2319
		return (0);
2321
	}
2320
	}
2322
	i = sizeof(struct netcred) + argp->ex_addrlen + argp->ex_masklen;
2321
	i = sizeof(struct netcred) + argp->ex_addrlen + argp->ex_masklen;
2323
	np = (struct netcred *) malloc(i, M_NETADDR, M_WAITOK);
2322
	np = (struct netcred *) malloc(i, M_NETADDR, M_WAITOK | M_ZERO);
2324
	bzero((caddr_t) np, i);
2325
	saddr = (struct sockaddr *) (np + 1);
2323
	saddr = (struct sockaddr *) (np + 1);
2326
	if ((error = copyin(argp->ex_addr, (caddr_t) saddr, argp->ex_addrlen)))
2324
	if ((error = copyin(argp->ex_addr, (caddr_t) saddr, argp->ex_addrlen)))
2327
		goto out;
2325
		goto out;
(-)vfs_syscalls.c (-2 / +1 lines)
Lines 255-262 Link Here
255
	/*
255
	/*
256
	 * Allocate and initialize the filesystem.
256
	 * Allocate and initialize the filesystem.
257
	 */
257
	 */
258
	mp = malloc(sizeof(struct mount), M_MOUNT, M_WAITOK);
258
	mp = malloc(sizeof(struct mount), M_MOUNT, M_WAITOK | M_ZERO);
259
	bzero((char *)mp, (u_long)sizeof(struct mount));
260
	lockinit(&mp->mnt_lock, PVFS, "vfslock", 0, LK_NOPAUSE);
259
	lockinit(&mp->mnt_lock, PVFS, "vfslock", 0, LK_NOPAUSE);
261
	(void)vfs_busy(mp, LK_NOWAIT, 0, p);
260
	(void)vfs_busy(mp, LK_NOWAIT, 0, p);
262
	mp->mnt_op = vfsp->vfc_vfsops;
261
	mp->mnt_op = vfsp->vfc_vfsops;

Return to bug 22168