Skip to content

Commit df6751f

Browse files
elfringNicholas Bellinger
authored andcommitted
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: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
1 parent f318aef commit df6751f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎drivers/target/target_core_transport.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2311,7 +2311,7 @@ void *transport_kmap_data_sg(struct se_cmd *cmd)
23112311
return kmap(sg_page(sg)) + sg->offset;
23122312

23132313
/* >1 page. use vmap */
2314-
pages = kmalloc(sizeof(*pages) * cmd->t_data_nents, GFP_KERNEL);
2314+
pages = kmalloc_array(cmd->t_data_nents, sizeof(*pages), GFP_KERNEL);
23152315
if (!pages)
23162316
return NULL;
23172317

0 commit comments

Comments
 (0)