lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181004175225.GA22487@minipc.home>
Date:   Thu, 4 Oct 2018 18:52:25 +0100
From:   Laurence Rochfort <laurence.rochfort@...il.com>
To:     Rob Springer <rspringer@...gle.com>,
        Todd Poynor <toddpoynor@...gle.com>,
        Ben Chan <benchan@...omium.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org
Subject: [PATCH] staging: gasket: Fix sparse "incorrect type in assignment"
 warnings.

Silence the below sparse warnings by casting betwen u8 __iomem *, and
void *.

warning: incorrect type in assignment (different address spaces)
   expected unsigned char [noderef] [usertype] <asn:2>*virt_base
   got void *[assigned] mem
warning: incorrect type in argument 3 (different address spaces)
   expected void *cpu_addr
   got unsigned char [noderef] [usertype] <asn:2>*virt_base

Signed-off-by: Laurence Rochfort <laurence.rochfort@...il.com>
---
 drivers/staging/gasket/gasket_page_table.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/gasket/gasket_page_table.c b/drivers/staging/gasket/gasket_page_table.c
index d4c5f8a..7f5e5b3 100644
--- a/drivers/staging/gasket/gasket_page_table.c
+++ b/drivers/staging/gasket/gasket_page_table.c
@@ -1278,7 +1278,7 @@ int gasket_alloc_coherent_memory(struct gasket_dev *gasket_dev, u64 size,
 				 dma_addr_t *dma_address, u64 index)
 {
 	dma_addr_t handle;
-	void *mem;
+	u8 __iomem *mem;
 	int j;
 	unsigned int num_pages = (size + PAGE_SIZE - 1) / PAGE_SIZE;
 	const struct gasket_driver_desc *driver_desc =
@@ -1290,7 +1290,7 @@ int gasket_alloc_coherent_memory(struct gasket_dev *gasket_dev, u64 size,
 	if (num_pages == 0)
 		return -EINVAL;
 
-	mem = dma_alloc_coherent(gasket_get_device(gasket_dev),
+	mem = (u8 __iomem *)dma_alloc_coherent(gasket_get_device(gasket_dev),
 				 num_pages * PAGE_SIZE, &handle, 0);
 	if (!mem)
 		goto nomem;
@@ -1325,7 +1325,7 @@ int gasket_alloc_coherent_memory(struct gasket_dev *gasket_dev, u64 size,
 nomem:
 	if (mem) {
 		dma_free_coherent(gasket_get_device(gasket_dev),
-				  num_pages * PAGE_SIZE, mem, handle);
+				  num_pages * PAGE_SIZE, (void __force *)mem, handle);
 	}
 
 	if (gasket_dev->page_table[index]->coherent_pages) {
@@ -1353,7 +1353,7 @@ int gasket_free_coherent_memory(struct gasket_dev *gasket_dev, u64 size,
 	if (gasket_dev->coherent_buffer.length_bytes) {
 		dma_free_coherent(gasket_get_device(gasket_dev),
 				  gasket_dev->coherent_buffer.length_bytes,
-				  gasket_dev->coherent_buffer.virt_base,
+				  (void __force *)gasket_dev->coherent_buffer.virt_base,
 				  gasket_dev->coherent_buffer.phys_base);
 		gasket_dev->coherent_buffer.length_bytes = 0;
 		gasket_dev->coherent_buffer.virt_base = NULL;
@@ -1372,7 +1372,7 @@ void gasket_free_coherent_memory_all(
 	if (gasket_dev->coherent_buffer.length_bytes) {
 		dma_free_coherent(gasket_get_device(gasket_dev),
 				  gasket_dev->coherent_buffer.length_bytes,
-				  gasket_dev->coherent_buffer.virt_base,
+				  (void __force *)gasket_dev->coherent_buffer.virt_base,
 				  gasket_dev->coherent_buffer.phys_base);
 		gasket_dev->coherent_buffer.length_bytes = 0;
 		gasket_dev->coherent_buffer.virt_base = NULL;
-- 
2.9.5

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ