summaryrefslogtreecommitdiff
path: root/src/udev/scsi_id
diff options
context:
space:
mode:
authorGreg KH <gregkh@linuxfoundation.org>2014-01-31 06:51:32 +0100
committerTom Gundersen <teg@jklm.no>2014-01-31 11:55:01 +0100
commit29804cc1e0f37ee34301530fd7f1eb8550be464e (patch)
treeba287b984b216279bb342579a9d1039383ca3a39 /src/udev/scsi_id
parentb5cfa7408c4cb68e9bb232fc34b07fd03c915617 (diff)
use memzero(foo, length); for all memset(foo, 0, length); calls
In trying to track down a stupid linker bug, I noticed a bunch of memset() calls that should be using memzero() to make it more "obvious" that the options are correct (i.e. 0 is not the length, but the data to set). So fix up all current calls to memset(foo, 0, length) to memzero(foo, length).
Diffstat (limited to 'src/udev/scsi_id')
-rw-r--r--src/udev/scsi_id/scsi_serial.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/udev/scsi_id/scsi_serial.c b/src/udev/scsi_id/scsi_serial.c
index 66e752e426..2f2afcee6e 100644
--- a/src/udev/scsi_id/scsi_serial.c
+++ b/src/udev/scsi_id/scsi_serial.c
@@ -331,7 +331,7 @@ static int scsi_inquiry(struct udev *udev,
resend:
if (dev_scsi->use_sg == 4) {
- memset(&io_v4, 0, sizeof(struct sg_io_v4));
+ memzero(&io_v4, sizeof(struct sg_io_v4));
io_v4.guard = 'Q';
io_v4.protocol = BSG_PROTOCOL_SCSI;
io_v4.subprotocol = BSG_SUB_PROTOCOL_SCSI_CMD;
@@ -343,7 +343,7 @@ resend:
io_v4.din_xferp = (uintptr_t)buf;
io_buf = (void *)&io_v4;
} else {
- memset(&io_hdr, 0, sizeof(struct sg_io_hdr));
+ memzero(&io_hdr, sizeof(struct sg_io_hdr));
io_hdr.interface_id = 'S';
io_hdr.cmd_len = sizeof(inq_cmd);
io_hdr.mx_sb_len = sizeof(sense);
@@ -410,7 +410,7 @@ static int do_scsi_page0_inquiry(struct udev *udev,
{
int retval;
- memset(buffer, 0, len);
+ memzero(buffer, len);
retval = scsi_inquiry(udev, dev_scsi, fd, 1, 0x0, buffer, len);
if (retval < 0)
return 1;
@@ -622,7 +622,7 @@ static int do_scsi_page83_inquiry(struct udev *udev,
/* also pick up the page 80 serial number */
do_scsi_page80_inquiry(udev, dev_scsi, fd, NULL, unit_serial_number, MAX_SERIAL_LEN);
- memset(page_83, 0, SCSI_INQ_BUFF_LEN);
+ memzero(page_83, SCSI_INQ_BUFF_LEN);
retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83,
SCSI_INQ_BUFF_LEN);
if (retval < 0)
@@ -709,7 +709,7 @@ static int do_scsi_page83_prespc3_inquiry(struct udev *udev,
int i, j;
unsigned char page_83[SCSI_INQ_BUFF_LEN];
- memset(page_83, 0, SCSI_INQ_BUFF_LEN);
+ memzero(page_83, SCSI_INQ_BUFF_LEN);
retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_83, page_83, SCSI_INQ_BUFF_LEN);
if (retval < 0)
return 1;
@@ -773,7 +773,7 @@ static int do_scsi_page80_inquiry(struct udev *udev,
int len;
unsigned char buf[SCSI_INQ_BUFF_LEN];
- memset(buf, 0, SCSI_INQ_BUFF_LEN);
+ memzero(buf, SCSI_INQ_BUFF_LEN);
retval = scsi_inquiry(udev, dev_scsi, fd, 1, PAGE_80, buf, SCSI_INQ_BUFF_LEN);
if (retval < 0)
return retval;
@@ -832,7 +832,7 @@ int scsi_std_inquiry(struct udev *udev,
sprintf(dev_scsi->kernel,"%d:%d", major(statbuf.st_rdev),
minor(statbuf.st_rdev));
- memset(buf, 0, SCSI_INQ_BUFF_LEN);
+ memzero(buf, SCSI_INQ_BUFF_LEN);
err = scsi_inquiry(udev, dev_scsi, fd, 0, 0, buf, SCSI_INQ_BUFF_LEN);
if (err < 0)
goto out;
@@ -861,7 +861,7 @@ int scsi_get_serial(struct udev *udev,
int ind;
int retval;
- memset(dev_scsi->serial, 0, len);
+ memzero(dev_scsi->serial, len);
srand((unsigned int)getpid());
for (cnt = 20; cnt > 0; cnt--) {
struct timespec duration;