From patchwork Fri Jan 24 09:28:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 11350003 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D8EAD159A for ; Fri, 24 Jan 2020 09:50:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B6CA5218AC for ; Fri, 24 Jan 2020 09:50:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579859449; bh=invVvVKYK/1dK5+OevdyADX2bdFmvZK6mtpBfUBztm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=uOm6tkKuks3xMynBZjpfEofCMhYHzdPl83eZUDi6NywFe3Jjxvl7mLPT0y1kkrVQv vRySeUB9kc6WEsVSvzdHX8AORrojRSnZVpNmGa1dOSw2NvloqlDXQFIUSEkPwvNWro lpAZvFOlR1ngWlY6oygV/gwuRRgKSAU4gk3KELzA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730766AbgAXJut (ORCPT ); Fri, 24 Jan 2020 04:50:49 -0500 Received: from mail.kernel.org ([198.145.29.99]:51642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730713AbgAXJus (ORCPT ); Fri, 24 Jan 2020 04:50:48 -0500 Received: from localhost (unknown [145.15.244.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5EA19206D5; Fri, 24 Jan 2020 09:50:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579859448; bh=invVvVKYK/1dK5+OevdyADX2bdFmvZK6mtpBfUBztm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BYfaJWKTKDnEDjrKCw/nOLtSt7aHwaF1cEBO5yDMmvLKL48B7X8q+FTE5vfeSa019 8S9e4SUgXdWnIswBYUHCtB3dVGqZitoCNMx9pDa/uBNQusPrmPm20/onx/DrIYgIDY SiuK4Y5mZAIjEugKb6VG36bu9JMzzUgLUVR4gLLg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kishon Vijay Abraham I , Wen Yang , Lorenzo Pieralisi , Bjorn Helgaas , Gustavo Pimentel , Niklas Cassel , Cyrille Pitchen , linux-pci@vger.kernel.org, Sasha Levin Subject: [PATCH 4.14 104/343] PCI: endpoint: functions: Use memcpy_fromio()/memcpy_toio() Date: Fri, 24 Jan 2020 10:28:42 +0100 Message-Id: <20200124092933.745397829@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124092919.490687572@linuxfoundation.org> References: <20200124092919.490687572@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Wen Yang [ 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 Signed-off-by: Wen Yang [lorenzo.pieralisi@arm.com: updated log] Signed-off-by: Lorenzo Pieralisi Acked-by: Kishon Vijay Abraham I CC: Lorenzo Pieralisi CC: Bjorn Helgaas CC: Gustavo Pimentel CC: Niklas Cassel CC: Greg Kroah-Hartman CC: Cyrille Pitchen CC: linux-pci@vger.kernel.org CC: linux-kernel@vger.kernel.org Signed-off-by: Sasha Levin --- drivers/pci/endpoint/functions/pci-epf-test.c | 4 ++-- 1 file 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 f9308c2f22e67..c2541a772abc8 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