Commit e2a980dd authored by Joe Korty's avatar Joe Korty Committed by Linus Torvalds

[PATCH] memset argument order misuses

A simple 'grep memset.*\<0);' shows argument order errors in several
uses of memset.

This grep was inspired by Al Viro's recent patch, megaraid_mbox fix,
which fixed this problem in the megaraid driver.
parent 85e58bfa
......@@ -149,8 +149,8 @@ dasd_destroy_partitions(struct dasd_device * device)
* Can't call delete_partitions directly. Use ioctl.
* The ioctl also does locking and invalidation.
*/
memset(&bpart, sizeof(struct blkpg_partition), 0);
memset(&barg, sizeof(struct blkpg_ioctl_arg), 0);
memset(&bpart, 0, sizeof(struct blkpg_partition));
memset(&barg, 0, sizeof(struct blkpg_ioctl_arg));
barg.data = &bpart;
barg.op = BLKPG_DEL_PARTITION;
for (bpart.pno = device->gdp->minors - 1; bpart.pno > 0; bpart.pno--)
......
......@@ -526,7 +526,7 @@ readall_cmb (struct ccw_device *cdev, struct cmbdata *data)
time = get_clock() - cdev->private->cmb_start_time;
spin_unlock_irqrestore(cdev->ccwlock, flags);
memset(data, sizeof(struct cmbdata), 0);
memset(data, 0, sizeof(struct cmbdata));
/* we only know values before device_busy_time */
data->size = offsetof(struct cmbdata, device_busy_time);
......@@ -736,7 +736,7 @@ readall_cmbe (struct ccw_device *cdev, struct cmbdata *data)
time = get_clock() - cdev->private->cmb_start_time;
spin_unlock_irqrestore(cdev->ccwlock, flags);
memset (data, sizeof(struct cmbdata), 0);
memset (data, 0, sizeof(struct cmbdata));
/* we only know values before device_busy_time */
data->size = offsetof(struct cmbdata, device_busy_time);
......
......@@ -527,7 +527,7 @@ css_enqueue_subchannel_slow(unsigned long schid)
new_slow_sch = kmalloc(sizeof(struct slow_subchannel), GFP_ATOMIC);
if (!new_slow_sch)
return -ENOMEM;
memset(new_slow_sch, sizeof(struct slow_subchannel), 0);
memset(new_slow_sch, 0, sizeof(struct slow_subchannel));
new_slow_sch->schid = schid;
spin_lock_irqsave(&slow_subchannel_lock, flags);
list_add_tail(&new_slow_sch->slow_list, &slow_subchannels_head);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment