diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2017-04-09 10:00:39 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2017-05-02 01:21:08 -0400 |
commit | 3829f38169aaf38c764afba852e320d8f3b006de (patch) | |
tree | 32de5b2eca1e1cfc56a2f49abde39b959fb30422 | |
parent | c46e22f10612d91fb2cceef232e9d73c34be212a (diff) |
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>
-rw-r--r-- | drivers/target/iscsi/iscsi_target.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c index 16750da1584a..0f7ade04b583 100644 --- a/drivers/target/iscsi/iscsi_target.c +++ b/drivers/target/iscsi/iscsi_target.c | |||
@@ -128,7 +128,7 @@ struct iscsi_tiqn *iscsit_add_tiqn(unsigned char *buf) | |||
128 | return ERR_PTR(-EINVAL); | 128 | return ERR_PTR(-EINVAL); |
129 | } | 129 | } |
130 | 130 | ||
131 | tiqn = kzalloc(sizeof(struct iscsi_tiqn), GFP_KERNEL); | 131 | tiqn = kzalloc(sizeof(*tiqn), GFP_KERNEL); |
132 | if (!tiqn) | 132 | if (!tiqn) |
133 | return ERR_PTR(-ENOMEM); | 133 | return ERR_PTR(-ENOMEM); |
134 | 134 | ||
@@ -360,7 +360,7 @@ struct iscsi_np *iscsit_add_np( | |||
360 | return np; | 360 | return np; |
361 | } | 361 | } |
362 | 362 | ||
363 | np = kzalloc(sizeof(struct iscsi_np), GFP_KERNEL); | 363 | np = kzalloc(sizeof(*np), GFP_KERNEL); |
364 | if (!np) { | 364 | if (!np) { |
365 | mutex_unlock(&np_lock); | 365 | mutex_unlock(&np_lock); |
366 | return ERR_PTR(-ENOMEM); | 366 | return ERR_PTR(-ENOMEM); |
@@ -693,8 +693,7 @@ static int __init iscsi_target_init_module(void) | |||
693 | int ret = 0, size; | 693 | int ret = 0, size; |
694 | 694 | ||
695 | pr_debug("iSCSI-Target "ISCSIT_VERSION"\n"); | 695 | pr_debug("iSCSI-Target "ISCSIT_VERSION"\n"); |
696 | 696 | iscsit_global = kzalloc(sizeof(*iscsit_global), GFP_KERNEL); | |
697 | iscsit_global = kzalloc(sizeof(struct iscsit_global), GFP_KERNEL); | ||
698 | if (!iscsit_global) | 697 | if (!iscsit_global) |
699 | return -1; | 698 | return -1; |
700 | 699 | ||
@@ -1986,8 +1985,7 @@ iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd, | |||
1986 | hdr->refcmdsn = cpu_to_be32(ISCSI_RESERVED_TAG); | 1985 | hdr->refcmdsn = cpu_to_be32(ISCSI_RESERVED_TAG); |
1987 | 1986 | ||
1988 | cmd->data_direction = DMA_NONE; | 1987 | cmd->data_direction = DMA_NONE; |
1989 | 1988 | cmd->tmr_req = kzalloc(sizeof(*cmd->tmr_req), GFP_KERNEL); | |
1990 | cmd->tmr_req = kzalloc(sizeof(struct iscsi_tmr_req), GFP_KERNEL); | ||
1991 | if (!cmd->tmr_req) | 1989 | if (!cmd->tmr_req) |
1992 | return iscsit_add_reject_cmd(cmd, | 1990 | return iscsit_add_reject_cmd(cmd, |
1993 | ISCSI_REASON_BOOKMARK_NO_RESOURCES, | 1991 | ISCSI_REASON_BOOKMARK_NO_RESOURCES, |