Skip to contentSkip to conversation

remoteproc: coredump: correct argument 2 type for memcpy_fromio

PATCH Superseded Peng Fan (OSS) 3 participants 3 messages Nov 10, 2021 – Nov 17, 2021 Remote processor (remoteproc)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 remoteproc: coredump: correct argument 2 type for memcpy_fromio

From: Peng Fan <[email protected]>

Address the sparse check warning:

Quoted 1 line
Quoted 1 line

drivers/remoteproc/remoteproc_coredump.c:169:53:

sparse: warning: incorrect type in argument 2 (different address spaces)
sparse:    expected void const volatile [noderef] __iomem *src
sparse:    got void *[assigned] ptr
---
 drivers/remoteproc/remoteproc_coredump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/remoteproc/remoteproc_coredump.c +1 -1
index aee657cc08c6..f39c98aa1b49 100644
@@ -166,7 +166,7 @@ static void rproc_copy_segment(struct rproc *rproc, void *dest,
 			memset(dest, 0xff, size);
 		} else {
 			if (is_iomem)
-				memcpy_fromio(dest, ptr, size);
+				memcpy_fromio(dest, (void const __iomem *)ptr, size);
 			else
 				memcpy(dest, ptr, size);
 		}
Signature · 1 line
2.25.1
maintainer
#1 lore raw

Hi Peng,

Quoted 19 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

Address the sparse check warning:

Quoted 1 line
Quoted 1 line

drivers/remoteproc/remoteproc_coredump.c:169:53:

sparse: warning: incorrect type in argument 2 (different address spaces)
sparse:    expected void const volatile [noderef] __iomem *src
sparse:    got void *[assigned] ptr
---
 drivers/remoteproc/remoteproc_coredump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/remoteproc/remoteproc_coredump.c +0 -0
index aee657cc08c6..f39c98aa1b49 100644

drivers/remoteproc/remoteproc_coredump.c static void rproc_copy_segment(struct rproc *rproc, void *dest, · line 169

Quoted 5 lines
drivers/remoteproc/remoteproc_coredump.c +1 -1
@@ -166,7 +166,7 @@ static void rproc_copy_segment(struct rproc *rproc, void *dest,
 			memset(dest, 0xff, size);
 		} else {
 			if (is_iomem)
-				memcpy_fromio(dest, ptr, size);
+				memcpy_fromio(dest, (void const __iomem *)ptr, size);

Shouldn't this be (const void __iomem *) to respect the signature in [1]?

[1]. https://elixir.bootlin.com/linux/latest/source/include/asm-generic/logic_io.h#L71

Quoted 6 lines
drivers/remoteproc/remoteproc_coredump.c +0 -0
 			else
 				memcpy(dest, ptr, size);
 		}
Signature · 1 line
2.25.1
#2 lore raw

Hi Mathieu,

Quoted 27 lines

Subject: Re: [PATCH] remoteproc: coredump: correct argument 2 type for memcpy_fromio

Hi Peng,

Quoted 8 lines · Peng Fan (OSS)

From: Peng Fan <[email protected]>

Address the sparse check warning:

Quoted 1 line
Quoted 1 line

drivers/remoteproc/remoteproc_coredump.c:169:53:

sparse: warning: incorrect type in argument 2 (different address spaces)
sparse:    expected void const volatile [noderef] __iomem *src
sparse:    got void *[assigned] ptr

Review

Quoted 7 lines
---
 drivers/remoteproc/remoteproc_coredump.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
(quoted diff) +0 -0

b/drivers/remoteproc/remoteproc_coredump.c

drivers/remoteproc/remoteproc_coredump.c static void rproc_copy_segment(struct rproc *rproc,

Quoted 4 lines

index aee657cc08c6..f39c98aa1b49 100644

drivers/remoteproc/remoteproc_coredump.c +0 -0
@@ -166,7 +166,7 @@ static void rproc_copy_segment(struct rproc *rproc,

void *dest,

Quoted 7 lines

drivers/remoteproc/remoteproc_coredump.c static void rproc_copy_segment(struct rproc *rproc, void *dest, · line 169

Quoted 5 lines
drivers/remoteproc/remoteproc_coredump.c +1 -1
 			memset(dest, 0xff, size);
 		} else {
 			if (is_iomem)
-				memcpy_fromio(dest, ptr, size);
+				memcpy_fromio(dest, (void const __iomem *)ptr, size);

Shouldn't this be (const void __iomem *) to respect the signature in [1]?

The sparse shows" sparse: expected void const volatile [noderef] __iomem *src"
I just send out V2 following your suggestion.

Thanks,
Peng.

Quoted 17 lines

[1].
https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Felixir.b
ootlin.com%2Flinux%2Flatest%2Fsource%2Finclude%2Fasm-generic%2Flogic_ io.h%23L71&amp;data=04%7C01%7Cpeng.fan%40nxp.com%7C8c6a9d750ea 94f5b09c508d9a931938f%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7 C0%7C637726852658866042%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4 wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&a mp;sdata=%2BBIKI5lOdwketjCiNhR3YLyK1xx9o7NhPuuLpjGU7J4%3D&amp;r eserved=0

Quoted 6 lines
drivers/remoteproc/remoteproc_coredump.c +0 -1
 			else
 				memcpy(dest, ptr, size);
 		}
--

2.25.1