summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2007-09-07 16:15:50 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2007-09-07 16:15:50 +0000
commit187ba8e20ad6081514a8c14c78d662f5f54d8aa3 (patch)
tree5703f2779023cfe87fd1bf62c454f28409ac5466 /sys/scsi
parent697b8a3c3977abff7ad937d1d543d84b61386179 (diff)
The obvious bzero/memset -> M_ZERO changes.
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/cd.c8
-rw-r--r--sys/scsi/ch.c5
-rw-r--r--sys/scsi/safte.c9
-rw-r--r--sys/scsi/scsi_ioctl.c5
-rw-r--r--sys/scsi/ses.c11
5 files changed, 14 insertions, 24 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index 0be05231d4e..9c3ad8448ea 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd.c,v 1.132 2007/06/20 18:15:47 deraadt Exp $ */
+/* $OpenBSD: cd.c,v 1.133 2007/09/07 16:15:48 krw Exp $ */
/* $NetBSD: cd.c,v 1.100 1997/04/02 02:29:30 mycroft Exp $ */
/*
@@ -1866,10 +1866,9 @@ dvd_read_disckey(cd, s)
struct scsi_read_dvd_structure_data *buf;
int error;
- buf = malloc(sizeof(*buf), M_TEMP, M_WAITOK);
+ buf = malloc(sizeof(*buf), M_TEMP, M_WAITOK | M_ZERO);
if (buf == NULL)
return (ENOMEM);
- bzero(buf, sizeof(*buf));
bzero(&cmd, sizeof(cmd));
cmd.opcode = GPCMD_READ_DVD_STRUCTURE;
@@ -1922,10 +1921,9 @@ dvd_read_manufact(cd, s)
struct scsi_read_dvd_structure_data *buf;
int error;
- buf = malloc(sizeof(*buf), M_TEMP, M_WAITOK);
+ buf = malloc(sizeof(*buf), M_TEMP, M_WAITOK | M_ZERO);
if (buf == NULL)
return (ENOMEM);
- bzero(buf, sizeof(*buf));
bzero(&cmd, sizeof(cmd));
cmd.opcode = GPCMD_READ_DVD_STRUCTURE;
diff --git a/sys/scsi/ch.c b/sys/scsi/ch.c
index 6dea2d3f9e1..f9e43684ecb 100644
--- a/sys/scsi/ch.c
+++ b/sys/scsi/ch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ch.c,v 1.32 2006/11/28 16:56:50 dlg Exp $ */
+/* $OpenBSD: ch.c,v 1.33 2007/09/07 16:15:49 krw Exp $ */
/* $NetBSD: ch.c,v 1.26 1997/02/21 22:06:52 thorpej Exp $ */
/*
@@ -606,8 +606,7 @@ ch_usergetelemstatus(sc, cesr)
}
udsize = avail * sizeof(struct changer_element_status);
- user_data = malloc(udsize, M_DEVBUF, M_WAITOK);
- bzero(user_data, udsize);
+ user_data = malloc(udsize, M_DEVBUF, M_WAITOK | M_ZERO);
desc = (struct read_element_status_descriptor *)((u_long)data +
sizeof(struct read_element_status_header) +
diff --git a/sys/scsi/safte.c b/sys/scsi/safte.c
index df0464e5205..6b77c78732c 100644
--- a/sys/scsi/safte.c
+++ b/sys/scsi/safte.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: safte.c,v 1.37 2007/06/24 05:34:35 dlg Exp $ */
+/* $OpenBSD: safte.c,v 1.38 2007/09/07 16:15:49 krw Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -293,7 +293,7 @@ safte_read_config(struct safte_softc *sc)
(config.doorlock ? 1 : 0) + (config.alarm ? 1 : 0);
sc->sc_sensors = malloc(sc->sc_nsensors * sizeof(struct safte_sensor),
- M_DEVBUF, M_NOWAIT);
+ M_DEVBUF, M_NOWAIT | M_ZERO);
if (sc->sc_sensors == NULL) {
free(sc->sc_encbuf, M_DEVBUF);
sc->sc_encbuf = NULL;
@@ -304,8 +304,6 @@ safte_read_config(struct safte_softc *sc)
strlcpy(sc->sc_sensordev.xname, DEVNAME(sc),
sizeof(sc->sc_sensordev.xname));
- memset(sc->sc_sensors, 0,
- sc->sc_nsensors * sizeof(struct safte_sensor));
s = sc->sc_sensors;
for (i = 0; i < config.nfans; i++) {
@@ -561,9 +559,8 @@ safte_bio_blink(struct safte_softc *sc, struct bioc_blink *blink)
if (slot >= sc->sc_nslots)
return (ENODEV);
- op = malloc(sizeof(struct safte_slotop), M_TEMP, 0);
+ op = malloc(sizeof(struct safte_slotop), M_TEMP, M_ZERO);
- memset(op, 0, sizeof(struct safte_slotop));
op->opcode = SAFTE_WRITE_SLOTOP;
op->slot = slot;
op->flags |= wantblink ? SAFTE_SLOTOP_IDENTIFY : 0;
diff --git a/sys/scsi/scsi_ioctl.c b/sys/scsi/scsi_ioctl.c
index 2b71e9b017b..a82c99231bd 100644
--- a/sys/scsi/scsi_ioctl.c
+++ b/sys/scsi/scsi_ioctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scsi_ioctl.c,v 1.28 2007/01/16 00:43:19 krw Exp $ */
+/* $OpenBSD: scsi_ioctl.c,v 1.29 2007/09/07 16:15:49 krw Exp $ */
/* $NetBSD: scsi_ioctl.c,v 1.23 1996/10/12 23:23:17 christos Exp $ */
/*
@@ -115,8 +115,7 @@ si_get(void)
struct scsi_ioctl *si;
int s;
- si = malloc(sizeof(struct scsi_ioctl), M_TEMP, M_WAITOK);
- bzero(si, sizeof(struct scsi_ioctl));
+ si = malloc(sizeof(struct scsi_ioctl), M_TEMP, M_WAITOK | M_ZERO);
s = splbio();
LIST_INSERT_HEAD(&si_head, si, si_list);
splx(s);
diff --git a/sys/scsi/ses.c b/sys/scsi/ses.c
index 1af264912fe..7871355e5dd 100644
--- a/sys/scsi/ses.c
+++ b/sys/scsi/ses.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ses.c,v 1.45 2007/06/24 05:34:35 dlg Exp $ */
+/* $OpenBSD: ses.c,v 1.46 2007/09/07 16:15:49 krw Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -271,11 +271,10 @@ ses_read_config(struct ses_softc *sc)
int i, ntypes = 0, nelems = 0;
- buf = malloc(SES_BUFLEN, M_DEVBUF, M_NOWAIT);
+ buf = malloc(SES_BUFLEN, M_DEVBUF, M_NOWAIT | M_ZERO);
if (buf == NULL)
return (1);
- memset(buf, 0, SES_BUFLEN);
memset(&cmd, 0, sizeof(cmd));
cmd.opcode = RECEIVE_DIAGNOSTIC;
cmd.flags |= SES_DIAG_PCV;
@@ -428,11 +427,10 @@ ses_make_sensors(struct ses_softc *sc, struct ses_type_desc *types, int ntypes)
#if NBIO > 0
case SES_T_DEVICE:
slot = malloc(sizeof(struct ses_slot),
- M_DEVBUF, M_NOWAIT);
+ M_DEVBUF, M_NOWAIT | M_ZERO);
if (slot == NULL)
goto error;
- memset(slot, 0, sizeof(struct ses_slot));
slot->sl_stat = status;
TAILQ_INSERT_TAIL(&sc->sc_slots, slot,
@@ -461,11 +459,10 @@ ses_make_sensors(struct ses_softc *sc, struct ses_type_desc *types, int ntypes)
}
sensor = malloc(sizeof(struct ses_sensor), M_DEVBUF,
- M_NOWAIT);
+ M_NOWAIT | M_ZERO);
if (sensor == NULL)
goto error;
- memset(sensor, 0, sizeof(struct ses_sensor));
sensor->se_type = types[i].type;
sensor->se_stat = status;
sensor->se_sensor.type = stype;