mirror of
https://github.com/torvalds/linux.git
synced 2024-12-11 21:52:04 +00:00
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>
This commit is contained in:
parent
f318aef55f
commit
df6751f340
@ -2311,7 +2311,7 @@ void *transport_kmap_data_sg(struct se_cmd *cmd)
|
||||
return kmap(sg_page(sg)) + sg->offset;
|
||||
|
||||
/* >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)
|
||||
return NULL;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user