Commit df6751f3 authored by Markus Elfring's avatar Markus Elfring Committed by Nicholas Bellinger

target: Use kmalloc_array() in transport_kmap_data_sg()

A multiplication for the size determination of a memory allocation
indicated that an array data structure should be processed.
Thus use the corresponding function "kmalloc_array".

This issue was detected by using the Coccinelle software.
Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
parent f318aef5
...@@ -2311,7 +2311,7 @@ void *transport_kmap_data_sg(struct se_cmd *cmd) ...@@ -2311,7 +2311,7 @@ void *transport_kmap_data_sg(struct se_cmd *cmd)
return kmap(sg_page(sg)) + sg->offset; return kmap(sg_page(sg)) + sg->offset;
/* >1 page. use vmap */ /* >1 page. use vmap */
pages = kmalloc(sizeof(*pages) * cmd->t_data_nents, GFP_KERNEL); pages = kmalloc_array(cmd->t_data_nents, sizeof(*pages), GFP_KERNEL);
if (!pages) if (!pages)
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment