mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 09:31:50 +00:00
vhost/scsi: Improve a size determination in four functions
Replace the specification of four data structures by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
4d32029b8d
commit
473f0b15a4
@ -586,8 +586,7 @@ vhost_scsi_get_tag(struct vhost_virtqueue *vq, struct vhost_scsi_tpg *tpg,
|
||||
sg = cmd->tvc_sgl;
|
||||
prot_sg = cmd->tvc_prot_sgl;
|
||||
pages = cmd->tvc_upages;
|
||||
memset(cmd, 0, sizeof(struct vhost_scsi_cmd));
|
||||
|
||||
memset(cmd, 0, sizeof(*cmd));
|
||||
cmd->tvc_sgl = sg;
|
||||
cmd->tvc_prot_sgl = prot_sg;
|
||||
cmd->tvc_upages = pages;
|
||||
@ -1725,7 +1724,7 @@ static int vhost_scsi_make_nexus(struct vhost_scsi_tpg *tpg,
|
||||
return -EEXIST;
|
||||
}
|
||||
|
||||
tv_nexus = kzalloc(sizeof(struct vhost_scsi_nexus), GFP_KERNEL);
|
||||
tv_nexus = kzalloc(sizeof(*tv_nexus), GFP_KERNEL);
|
||||
if (!tv_nexus) {
|
||||
mutex_unlock(&tpg->tv_tpg_mutex);
|
||||
pr_err("Unable to allocate struct vhost_scsi_nexus\n");
|
||||
@ -1926,7 +1925,7 @@ vhost_scsi_make_tpg(struct se_wwn *wwn,
|
||||
if (kstrtou16(name + 5, 10, &tpgt) || tpgt >= VHOST_SCSI_MAX_TARGET)
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
tpg = kzalloc(sizeof(struct vhost_scsi_tpg), GFP_KERNEL);
|
||||
tpg = kzalloc(sizeof(*tpg), GFP_KERNEL);
|
||||
if (!tpg) {
|
||||
pr_err("Unable to allocate struct vhost_scsi_tpg");
|
||||
return ERR_PTR(-ENOMEM);
|
||||
@ -1980,7 +1979,7 @@ vhost_scsi_make_tport(struct target_fabric_configfs *tf,
|
||||
/* if (vhost_scsi_parse_wwn(name, &wwpn, 1) < 0)
|
||||
return ERR_PTR(-EINVAL); */
|
||||
|
||||
tport = kzalloc(sizeof(struct vhost_scsi_tport), GFP_KERNEL);
|
||||
tport = kzalloc(sizeof(*tport), GFP_KERNEL);
|
||||
if (!tport) {
|
||||
pr_err("Unable to allocate struct vhost_scsi_tport");
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
Loading…
Reference in New Issue
Block a user