diff options
author | scottl <scottl@FreeBSD.org> | 2007-04-09 05:47:32 +0000 |
---|---|---|
committer | scottl <scottl@FreeBSD.org> | 2007-04-09 05:47:32 +0000 |
commit | 1212cb7f9518158dff682923da135a66fb0a2835 (patch) | |
tree | 5285aea22d649b2fa49de875d1bafb4ac04ff715 /sys/cam | |
parent | 5b7094227581bde3e96e8bd92898c82987b9982d (diff) | |
download | FreeBSD-src-1212cb7f9518158dff682923da135a66fb0a2835.zip FreeBSD-src-1212cb7f9518158dff682923da135a66fb0a2835.tar.gz |
Make use of M_ZERO in various malloc calls.
Diffstat (limited to 'sys/cam')
-rw-r--r-- | sys/cam/scsi/scsi_sg.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/cam/scsi/scsi_sg.c b/sys/cam/scsi/scsi_sg.c index 6eeedad..b51d0d9 100644 --- a/sys/cam/scsi/scsi_sg.c +++ b/sys/cam/scsi/scsi_sg.c @@ -289,13 +289,12 @@ sgregister(struct cam_periph *periph, void *arg) return (CAM_REQ_CMP_ERR); } - softc = (struct sg_softc *)malloc(sizeof(*softc), M_DEVBUF, M_NOWAIT); + softc = malloc(sizeof(*softc), M_DEVBUF, M_ZERO | M_NOWAIT); if (softc == NULL) { printf("sgregister: Unable to allocate softc\n"); return (CAM_REQ_CMP_ERR); } - bzero(softc, sizeof(*softc)); softc->state = SG_STATE_NORMAL; softc->pd_type = SID_TYPE(&cgd->inq_data); TAILQ_INIT(&softc->rdwr_done); @@ -679,7 +678,7 @@ sgwrite(struct cdev *dev, struct uio *uio, int ioflag) periph = dev->si_drv1; sc = periph->softc; - rdwr = malloc(sizeof(*rdwr), M_DEVBUF, M_WAITOK); + rdwr = malloc(sizeof(*rdwr), M_DEVBUF, M_WAITOK | M_ZERO); hdr = &rdwr->hdr.hdr; /* Copy in the header block and sanity check it */ @@ -728,13 +727,13 @@ sgwrite(struct cdev *dev, struct uio *uio, int ioflag) */ buf_len = uio->uio_resid; if (buf_len != 0) { - buf = malloc(buf_len, M_DEVBUF, M_WAITOK); + buf = malloc(buf_len, M_DEVBUF, M_WAITOK | M_ZERO); error = uiomove(buf, buf_len, uio); if (error) goto out_buf; dir = CAM_DIR_OUT; } else if (hdr->reply_len != 0) { - buf = malloc(hdr->reply_len, M_DEVBUF, M_WAITOK); + buf = malloc(hdr->reply_len, M_DEVBUF, M_WAITOK | M_ZERO); buf_len = hdr->reply_len; dir = CAM_DIR_IN; } else { |