diff options
author | Benoit Taine <benoit.taine@lip6.fr> | 2014-05-26 11:21:16 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-05-28 12:13:19 -0400 |
commit | c1818f17b58e416ec19653be430e9e2925cec35c (patch) | |
tree | 4da70e730b3435747cae039c242d49d738c09b9f | |
parent | 3d30b439f0f02416e8bd784a52d0321e0c25f9fc (diff) |
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: Benoit Taine <benoit.taine@lip6.fr>
Acked-by: Saurav Kashyap <saurav.kashyap@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | drivers/scsi/qla2xxx/qla_mbx.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 7f39e3605027..1c33a77db5c2 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c | |||
@@ -1319,7 +1319,7 @@ qla2x00_get_node_name_list(scsi_qla_host_t *vha, void **out_data, int *out_len) | |||
1319 | 1319 | ||
1320 | left = 0; | 1320 | left = 0; |
1321 | 1321 | ||
1322 | list = kzalloc(dma_size, GFP_KERNEL); | 1322 | list = kmemdup(pmap, dma_size, GFP_KERNEL); |
1323 | if (!list) { | 1323 | if (!list) { |
1324 | ql_log(ql_log_warn, vha, 0x1140, | 1324 | ql_log(ql_log_warn, vha, 0x1140, |
1325 | "%s(%ld): failed to allocate node names list " | 1325 | "%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 | goto out_free; | 1328 | goto out_free; |
1329 | } | 1329 | } |
1330 | 1330 | ||
1331 | memcpy(list, pmap, dma_size); | ||
1332 | restart: | 1331 | restart: |
1333 | dma_free_coherent(&ha->pdev->dev, dma_size, pmap, pmap_dma); | 1332 | dma_free_coherent(&ha->pdev->dev, dma_size, pmap, pmap_dma); |
1334 | } | 1333 | } |