summaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2017-04-09 09:06:00 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2017-05-02 01:21:05 -0400
commitf1725110324d97d841609fd0b3536eb3ead77086 (patch)
treedd8838a43c9eb4ee43d58c1762f35d59fce81235 /drivers/target
parent056e8924a072d22007275dfb8b247bb814765b67 (diff)
iscsi-target: Use kcalloc() in iscsit_allocate_iovecs()
* A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kcalloc". This issue was detected by using the Coccinelle software. * Replace the specification of a data structure by a pointer dereference 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> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/iscsi/iscsi_target.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index e3f9ed3690b7..3cf9fb54b7d4 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -984,8 +984,7 @@ static int iscsit_allocate_iovecs(struct iscsi_cmd *cmd)
984 u32 iov_count = max(1UL, DIV_ROUND_UP(cmd->se_cmd.data_length, PAGE_SIZE)); 984 u32 iov_count = max(1UL, DIV_ROUND_UP(cmd->se_cmd.data_length, PAGE_SIZE));
985 985
986 iov_count += ISCSI_IOV_DATA_BUFFER; 986 iov_count += ISCSI_IOV_DATA_BUFFER;
987 987 cmd->iov_data = kcalloc(iov_count, sizeof(*cmd->iov_data), GFP_KERNEL);
988 cmd->iov_data = kzalloc(iov_count * sizeof(struct kvec), GFP_KERNEL);
989 if (!cmd->iov_data) { 988 if (!cmd->iov_data) {
990 pr_err("Unable to allocate cmd->iov_data\n"); 989 pr_err("Unable to allocate cmd->iov_data\n");
991 return -ENOMEM; 990 return -ENOMEM;