summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla4xxx
diff options
context:
space:
mode:
authorBenoit Taine <benoit.taine@lip6.fr>2014-05-26 17:21:13 +0200
committerChristoph Hellwig <hch@lst.de>2014-05-28 18:13:19 +0200
commit3d30b439f0f02416e8bd784a52d0321e0c25f9fc (patch)
tree5ac24b24e79b4daa25cc73e054138c9cbf03a1ce /drivers/scsi/qla4xxx
parentf92f82d676d40d262733c48da5837196e8bc9f18 (diff)
downloadlinux-3d30b439f0f02416e8bd784a52d0321e0c25f9fc.tar.gz
linux-3d30b439f0f02416e8bd784a52d0321e0c25f9fc.tar.bz2
linux-3d30b439f0f02416e8bd784a52d0321e0c25f9fc.zip
qla4xxx: 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: Vikas Chaudhary <vikas.chaudhary@qlogic.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'drivers/scsi/qla4xxx')
-rw-r--r--drivers/scsi/qla4xxx/ql4_os.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index 9eef7d41522f..320206376206 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -3565,14 +3565,13 @@ static int qla4xxx_copy_from_fwddb_param(struct iscsi_bus_flash_session *sess,
if (test_bit(OPT_IPV6_DEVICE, &options)) {
conn->ipv6_traffic_class = fw_ddb_entry->ipv4_tos;
- conn->link_local_ipv6_addr = kzalloc(IPv6_ADDR_LEN, GFP_KERNEL);
+ conn->link_local_ipv6_addr = kmemdup(
+ fw_ddb_entry->link_local_ipv6_addr,
+ IPv6_ADDR_LEN, GFP_KERNEL);
if (!conn->link_local_ipv6_addr) {
rc = -ENOMEM;
goto exit_copy;
}
-
- memcpy(conn->link_local_ipv6_addr,
- fw_ddb_entry->link_local_ipv6_addr, IPv6_ADDR_LEN);
} else {
conn->ipv4_tos = fw_ddb_entry->ipv4_tos;
}