dump_stack();
}
- shost = kmalloc(sizeof(struct Scsi_Host) + privsize, gfp_mask);
+ shost = kzalloc(sizeof(struct Scsi_Host) + privsize, gfp_mask);
if (!shost)
return NULL;
- memset(shost, 0, sizeof(struct Scsi_Host) + privsize);
spin_lock_init(&shost->default_lock);
scsi_assign_lock(shost, &shost->default_lock);
const int size = offset + sizeof(struct request);
struct scsi_request *sreq;
- sreq = kmalloc(size, gfp_mask);
+ sreq = kzalloc(size, gfp_mask);
if (likely(sreq != NULL)) {
- memset(sreq, 0, size);
sreq->sr_request = (struct request *)(((char *)sreq) + offset);
sreq->sr_device = sdev;
sreq->sr_host = sdev->host;
}
}
if (NULL == open_devip) { /* try and make a new one */
- open_devip = kmalloc(sizeof(*open_devip),GFP_KERNEL);
+ open_devip = kzalloc(sizeof(*open_devip),GFP_KERNEL);
if (NULL == open_devip) {
printk(KERN_ERR "%s: out of memory at line %d\n",
__FUNCTION__, __LINE__);
return NULL;
}
- memset(open_devip, 0, sizeof(*open_devip));
open_devip->sdbg_host = sdbg_host;
list_add_tail(&open_devip->dev_list,
&sdbg_host->dev_info_list);
struct sdebug_dev_info *sdbg_devinfo;
struct list_head *lh, *lh_sf;
- sdbg_host = kmalloc(sizeof(*sdbg_host),GFP_KERNEL);
+ sdbg_host = kzalloc(sizeof(*sdbg_host), GFP_KERNEL);
if (NULL == sdbg_host) {
printk(KERN_ERR "%s: out of memory at line %d\n",
return -ENOMEM;
}
- memset(sdbg_host, 0, sizeof(*sdbg_host));
INIT_LIST_HEAD(&sdbg_host->dev_info_list);
devs_per_host = scsi_debug_num_tgts * scsi_debug_max_luns;
for (k = 0; k < devs_per_host; k++) {
- sdbg_devinfo = kmalloc(sizeof(*sdbg_devinfo),GFP_KERNEL);
+ sdbg_devinfo = kzalloc(sizeof(*sdbg_devinfo), GFP_KERNEL);
if (NULL == sdbg_devinfo) {
printk(KERN_ERR "%s: out of memory at line %d\n",
__FUNCTION__, __LINE__);
error = -ENOMEM;
goto clean;
}
- memset(sdbg_devinfo, 0, sizeof(*sdbg_devinfo));
sdbg_devinfo->sdbg_host = sdbg_host;
list_add_tail(&sdbg_devinfo->dev_list,
&sdbg_host->dev_info_list);
buf_needed = (buf_needed + 511) & ~511;
if (buf_needed > MAX_BUF)
buf_needed = MAX_BUF;
- buf = kmalloc(buf_needed, gfp_mask);
+ buf = kzalloc(buf_needed, gfp_mask);
if (!buf)
return -ENOMEM;
- memset(buf, 0, buf_needed);
if (inlen == 0) {
data_direction = DMA_FROM_DEVICE;
} else if (outlen == 0 ) {
int result;
if (sshdr) {
- sense = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_NOIO);
+ sense = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_NOIO);
if (!sense)
return DRIVER_ERROR << 24;
- memset(sense, 0, SCSI_SENSE_BUFFERSIZE);
}
result = scsi_execute(sdev, cmd, data_direction, buffer, bufflen,
- sense, timeout, retries, 0);
+ sense, timeout, retries, 0);
if (sshdr)
scsi_normalize_sense(sense, SCSI_SENSE_BUFFERSIZE, sshdr);
int display_failure_msg = 1, ret;
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
- sdev = kmalloc(sizeof(*sdev) + shost->transportt->device_size,
+ sdev = kzalloc(sizeof(*sdev) + shost->transportt->device_size,
GFP_ATOMIC);
if (!sdev)
goto out;
- memset(sdev, 0, sizeof(*sdev));
sdev->vendor = scsi_null_device_strs;
sdev->model = scsi_null_device_strs;
sdev->rev = scsi_null_device_strs;
struct scsi_target *starget;
struct scsi_target *found_target;
- starget = kmalloc(size, GFP_KERNEL);
+ starget = kzalloc(size, GFP_KERNEL);
if (!starget) {
printk(KERN_ERR "%s: allocation failure\n", __FUNCTION__);
return NULL;
}
- memset(starget, 0, size);
dev = &starget->dev;
device_initialize(dev);
starget->reap_ref = 1;
struct scsi_transport_template *
fc_attach_transport(struct fc_function_template *ft)
{
- struct fc_internal *i = kmalloc(sizeof(struct fc_internal),
- GFP_KERNEL);
int count;
+ struct fc_internal *i = kzalloc(sizeof(struct fc_internal),
+ GFP_KERNEL);
if (unlikely(!i))
return NULL;
- memset(i, 0, sizeof(struct fc_internal));
-
i->t.target_attrs.ac.attrs = &i->starget_attrs[0];
i->t.target_attrs.ac.class = &fc_transport_class.class;
i->t.target_attrs.ac.match = fc_target_match;
size_t size;
size = (sizeof(struct fc_rport) + fci->f->dd_fcrport_size);
- rport = kmalloc(size, GFP_KERNEL);
+ rport = kzalloc(size, GFP_KERNEL);
if (unlikely(!rport)) {
printk(KERN_ERR "%s: allocation failure\n", __FUNCTION__);
return NULL;
}
- memset(rport, 0, size);
rport->maxframe_size = -1;
rport->supported_classes = FC_COS_UNSPECIFIED;
if (priv)
return NULL;
- priv = kmalloc(sizeof(*priv), GFP_KERNEL);
+ priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv)
return NULL;
- memset(priv, 0, sizeof(*priv));
INIT_LIST_HEAD(&priv->list);
priv->iscsi_transport = tt;
struct Scsi_Host *shost = dev_to_shost(parent);
struct sas_phy *phy;
- phy = kmalloc(sizeof(*phy), GFP_KERNEL);
+ phy = kzalloc(sizeof(*phy), GFP_KERNEL);
if (!phy)
return NULL;
- memset(phy, 0, sizeof(*phy));
get_device(parent);
struct Scsi_Host *shost = dev_to_shost(&parent->dev);
struct sas_rphy *rphy;
- rphy = kmalloc(sizeof(*rphy), GFP_KERNEL);
+ rphy = kzalloc(sizeof(*rphy), GFP_KERNEL);
if (!rphy) {
put_device(&parent->dev);
return NULL;
}
- memset(rphy, 0, sizeof(*rphy));
device_initialize(&rphy->dev);
rphy->dev.parent = get_device(&parent->dev);
struct sas_internal *i;
int count;
- i = kmalloc(sizeof(struct sas_internal), GFP_KERNEL);
+ i = kzalloc(sizeof(struct sas_internal), GFP_KERNEL);
if (!i)
return NULL;
- memset(i, 0, sizeof(struct sas_internal));
i->t.user_scan = sas_user_scan;
if (unlikely(scsi_device_get(sdev)))
return;
- buffer = kmalloc(len, GFP_KERNEL);
+ buffer = kzalloc(len, GFP_KERNEL);
if (unlikely(!buffer))
goto out_put;
- memset(buffer, 0, len);
-
/* We need to verify that the actual device will quiesce; the
* later target quiesce is just a nice to have */
if (unlikely(scsi_device_quiesce(sdev)))
struct scsi_transport_template *
spi_attach_transport(struct spi_function_template *ft)
{
- struct spi_internal *i = kmalloc(sizeof(struct spi_internal),
- GFP_KERNEL);
int count = 0;
+ struct spi_internal *i = kzalloc(sizeof(struct spi_internal),
+ GFP_KERNEL);
+
if (unlikely(!i))
return NULL;
- memset(i, 0, sizeof(struct spi_internal));
-
-
i->t.target_attrs.ac.class = &spi_transport_class.class;
i->t.target_attrs.ac.attrs = &i->attrs[0];
i->t.target_attrs.ac.match = spi_target_match;
"sd_attach\n"));
error = -ENOMEM;
- sdkp = kmalloc(sizeof(*sdkp), GFP_KERNEL);
+ sdkp = kzalloc(sizeof(*sdkp), GFP_KERNEL);
if (!sdkp)
goto out;
- memset (sdkp, 0, sizeof(*sdkp));
kref_init(&sdkp->kref);
gd = alloc_disk(16);
void *old_sg_dev_arr = NULL;
int k, error;
- sdp = kmalloc(sizeof(Sg_device), GFP_KERNEL);
+ sdp = kzalloc(sizeof(Sg_device), GFP_KERNEL);
if (!sdp) {
printk(KERN_WARNING "kmalloc Sg_device failure\n");
return -ENOMEM;
int tmp_dev_max = sg_nr_dev + SG_DEV_ARR_LUMP;
write_unlock_irqrestore(&sg_dev_arr_lock, iflags);
- tmp_da = kmalloc(tmp_dev_max * sizeof(Sg_device *), GFP_KERNEL);
+ tmp_da = kzalloc(tmp_dev_max * sizeof(Sg_device *), GFP_KERNEL);
if (unlikely(!tmp_da))
goto expand_failed;
write_lock_irqsave(&sg_dev_arr_lock, iflags);
- memset(tmp_da, 0, tmp_dev_max * sizeof(Sg_device *));
memcpy(tmp_da, sg_dev_arr, sg_dev_max * sizeof(Sg_device *));
old_sg_dev_arr = sg_dev_arr;
sg_dev_arr = tmp_da;
if (unlikely(k >= SG_MAX_DEVS))
goto overflow;
- memset(sdp, 0, sizeof(*sdp));
SCSI_LOG_TIMEOUT(3, printk("sg_alloc: dev=%d \n", k));
sprintf(disk->disk_name, "sg%d", k);
disk->first_minor = k;
goto fail;
error = -ENOMEM;
- cd = kmalloc(sizeof(*cd), GFP_KERNEL);
+ cd = kzalloc(sizeof(*cd), GFP_KERNEL);
if (!cd)
goto fail;
- memset(cd, 0, sizeof(*cd));
kref_init(&cd->kref);
int result;
unsigned char *buffer;
- buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd));
+ buffer = kzalloc(32, GFP_KERNEL | SR_GFP_DMA(cd));
if (!buffer)
return -ENOMEM;
- memset(&cgc, 0, sizeof(struct packet_command));
cgc.timeout = IOCTL_TIMEOUT;
cgc.cmd[0] = GPCMD_READ_TOC_PMA_ATIP;
cgc.cmd[8] = 12; /* LSB of length */
int result;
unsigned char *buffer;
- buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd));
+ buffer = kzalloc(32, GFP_KERNEL | SR_GFP_DMA(cd));
if (!buffer)
return -ENOMEM;
- memset(&cgc, 0, sizeof(struct packet_command));
cgc.timeout = IOCTL_TIMEOUT;
cgc.cmd[0] = GPCMD_READ_TOC_PMA_ATIP;
cgc.cmd[1] |= (tocentry->cdte_format == CDROM_MSF) ? 0x02 : 0;
i = sizeof(struct st_buffer) + (max_sg - 1) * sizeof(struct scatterlist) +
max_sg * sizeof(struct st_buf_fragment);
- tb = kmalloc(i, priority);
+ tb = kzalloc(i, priority);
if (!tb) {
printk(KERN_NOTICE "st: Can't allocate new tape buffer.\n");
return NULL;
}
- memset(tb, 0, i);
tb->frp_segs = tb->orig_frp_segs = 0;
tb->use_sg = max_sg;
tb->frp = (struct st_buf_fragment *)(&(tb->sg[0]) + max_sg);
goto out_put_disk;
}
- tmp_da = kmalloc(tmp_dev_max * sizeof(struct scsi_tape *), GFP_ATOMIC);
+ tmp_da = kzalloc(tmp_dev_max * sizeof(struct scsi_tape *), GFP_ATOMIC);
if (tmp_da == NULL) {
write_unlock(&st_dev_arr_lock);
printk(KERN_ERR "st: Can't extend device array.\n");
goto out_put_disk;
}
- memset(tmp_da, 0, tmp_dev_max * sizeof(struct scsi_tape *));
if (scsi_tapes != NULL) {
memcpy(tmp_da, scsi_tapes,
st_dev_max * sizeof(struct scsi_tape *));
if (i >= st_dev_max)
panic("scsi_devices corrupt (st)");
- tpnt = kmalloc(sizeof(struct scsi_tape), GFP_ATOMIC);
+ tpnt = kzalloc(sizeof(struct scsi_tape), GFP_ATOMIC);
if (tpnt == NULL) {
write_unlock(&st_dev_arr_lock);
printk(KERN_ERR "st: Can't allocate device descriptor.\n");
goto out_put_disk;
}
- memset(tpnt, 0, sizeof(struct scsi_tape));
kref_init(&tpnt->kref);
tpnt->disk = disk;
sprintf(disk->disk_name, "st%d", i);