Commit c1818f17 authored by Benoit Taine's avatar Benoit Taine Committed by Christoph Hellwig

qla2xxx: Use kmemdup instead of kmalloc + memcpy

This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/memdup.cocci
Signed-off-by: default avatarBenoit Taine <benoit.taine@lip6.fr>
Acked-by: default avatarSaurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 3d30b439
...@@ -1319,7 +1319,7 @@ qla2x00_get_node_name_list(scsi_qla_host_t *vha, void **out_data, int *out_len) ...@@ -1319,7 +1319,7 @@ qla2x00_get_node_name_list(scsi_qla_host_t *vha, void **out_data, int *out_len)
left = 0; left = 0;
list = kzalloc(dma_size, GFP_KERNEL); list = kmemdup(pmap, dma_size, GFP_KERNEL);
if (!list) { if (!list) {
ql_log(ql_log_warn, vha, 0x1140, ql_log(ql_log_warn, vha, 0x1140,
"%s(%ld): failed to allocate node names list " "%s(%ld): failed to allocate node names list "
...@@ -1328,7 +1328,6 @@ qla2x00_get_node_name_list(scsi_qla_host_t *vha, void **out_data, int *out_len) ...@@ -1328,7 +1328,6 @@ qla2x00_get_node_name_list(scsi_qla_host_t *vha, void **out_data, int *out_len)
goto out_free; goto out_free;
} }
memcpy(list, pmap, dma_size);
restart: restart:
dma_free_coherent(&ha->pdev->dev, dma_size, pmap, pmap_dma); dma_free_coherent(&ha->pdev->dev, dma_size, pmap, pmap_dma);
} }
......
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