iscsi-target: Improve size determinations 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 determinations a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
This commit is contained in:
committed by
Nicholas Bellinger
parent
c46e22f106
commit
3829f38169
@@ -128,7 +128,7 @@ struct iscsi_tiqn *iscsit_add_tiqn(unsigned char *buf)
|
|||||||
return ERR_PTR(-EINVAL);
|
return ERR_PTR(-EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
tiqn = kzalloc(sizeof(struct iscsi_tiqn), GFP_KERNEL);
|
tiqn = kzalloc(sizeof(*tiqn), GFP_KERNEL);
|
||||||
if (!tiqn)
|
if (!tiqn)
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
|
||||||
@@ -360,7 +360,7 @@ struct iscsi_np *iscsit_add_np(
|
|||||||
return np;
|
return np;
|
||||||
}
|
}
|
||||||
|
|
||||||
np = kzalloc(sizeof(struct iscsi_np), GFP_KERNEL);
|
np = kzalloc(sizeof(*np), GFP_KERNEL);
|
||||||
if (!np) {
|
if (!np) {
|
||||||
mutex_unlock(&np_lock);
|
mutex_unlock(&np_lock);
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
@@ -693,8 +693,7 @@ static int __init iscsi_target_init_module(void)
|
|||||||
int ret = 0, size;
|
int ret = 0, size;
|
||||||
|
|
||||||
pr_debug("iSCSI-Target "ISCSIT_VERSION"\n");
|
pr_debug("iSCSI-Target "ISCSIT_VERSION"\n");
|
||||||
|
iscsit_global = kzalloc(sizeof(*iscsit_global), GFP_KERNEL);
|
||||||
iscsit_global = kzalloc(sizeof(struct iscsit_global), GFP_KERNEL);
|
|
||||||
if (!iscsit_global)
|
if (!iscsit_global)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@@ -1986,8 +1985,7 @@ iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
|
|||||||
hdr->refcmdsn = cpu_to_be32(ISCSI_RESERVED_TAG);
|
hdr->refcmdsn = cpu_to_be32(ISCSI_RESERVED_TAG);
|
||||||
|
|
||||||
cmd->data_direction = DMA_NONE;
|
cmd->data_direction = DMA_NONE;
|
||||||
|
cmd->tmr_req = kzalloc(sizeof(*cmd->tmr_req), GFP_KERNEL);
|
||||||
cmd->tmr_req = kzalloc(sizeof(struct iscsi_tmr_req), GFP_KERNEL);
|
|
||||||
if (!cmd->tmr_req)
|
if (!cmd->tmr_req)
|
||||||
return iscsit_add_reject_cmd(cmd,
|
return iscsit_add_reject_cmd(cmd,
|
||||||
ISCSI_REASON_BOOKMARK_NO_RESOURCES,
|
ISCSI_REASON_BOOKMARK_NO_RESOURCES,
|
||||||
|
|||||||
Reference in New Issue
Block a user