summaryrefslogtreecommitdiff
path: root/src/scsi_id
diff options
context:
space:
mode:
authorGreg KH <gregkh@linuxfoundation.org>2014-02-02 07:15:23 -0500
committerAnthony G. Basile <blueness@gentoo.org>2014-02-02 07:15:23 -0500
commit8fe035158681d0324ff2be99a67bc0434da6faad (patch)
treec9a82a131e2597a62ed392355e39dfc7a888da9d /src/scsi_id
parent7eefa0ad0db267d99448fcddff2aebb4ebc33f6f (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). Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/scsi_id')
-rw-r--r--src/scsi_id/scsi_serial.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/scsi_id/scsi_serial.c b/src/scsi_id/scsi_serial.c
index 66e752e426..2f2afcee6e 100644
--- a/src/scsi_id/scsi_serial.c
+++ b/src/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;