summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWen Yang <wen.yang99@zte.com.cn>2019-02-11 17:04:00 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-27 14:46:19 +0100
commit7020a36d86bc76f49fffaf3cdf668b4a781a7b4f (patch)
tree1e20ebb924bfd7f0ed2165ad9779d82ec9b7695f
parent36f3abf8c0fccd453e45e9ab6638cbaa9ad48586 (diff)
downloadlinux-stable-7020a36d86bc76f49fffaf3cdf668b4a781a7b4f.tar.gz
linux-stable-7020a36d86bc76f49fffaf3cdf668b4a781a7b4f.tar.bz2
linux-stable-7020a36d86bc76f49fffaf3cdf668b4a781a7b4f.zip
PCI: endpoint: functions: Use memcpy_fromio()/memcpy_toio()
[ Upstream commit 726dabfde6aa35a4f1508e235ae37edbbf9fbc65 ] Functions copying from/to IO addresses should use the memcpy_fromio()/memcpy_toio() API rather than plain memcpy(). Fix the issue detected through the sparse tool. Fixes: 349e7a85b25f ("PCI: endpoint: functions: Add an EP function to test PCI") Suggested-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Wen Yang <wen.yang99@zte.com.cn> [lorenzo.pieralisi@arm.com: updated log] Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Acked-by: Kishon Vijay Abraham I <kishon@ti.com> CC: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> CC: Bjorn Helgaas <bhelgaas@google.com> CC: Gustavo Pimentel <gustavo.pimentel@synopsys.com> CC: Niklas Cassel <niklas.cassel@axis.com> CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org> CC: Cyrille Pitchen <cyrille.pitchen@free-electrons.com> CC: linux-pci@vger.kernel.org CC: linux-kernel@vger.kernel.org Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--drivers/pci/endpoint/functions/pci-epf-test.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index f9308c2f22e6..c2541a772abc 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -177,7 +177,7 @@ static int pci_epf_test_read(struct pci_epf_test *epf_test)
goto err_map_addr;
}
- memcpy(buf, src_addr, reg->size);
+ memcpy_fromio(buf, src_addr, reg->size);
crc32 = crc32_le(~0, buf, reg->size);
if (crc32 != reg->checksum)
@@ -231,7 +231,7 @@ static int pci_epf_test_write(struct pci_epf_test *epf_test)
get_random_bytes(buf, reg->size);
reg->checksum = crc32_le(~0, buf, reg->size);
- memcpy(dst_addr, buf, reg->size);
+ memcpy_toio(dst_addr, buf, reg->size);
/*
* wait 1ms inorder for the write to complete. Without this delay L3