public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64/uprobes: change the uprobe_opcode_t typedef to fix the sparse warning
@ 2022-12-16  8:50 guo.ziliang
  0 siblings, 0 replies; 3+ messages in thread
From: guo.ziliang @ 2022-12-16  8:50 UTC (permalink / raw)
  To: catalin.marinas
  Cc: will, linux-arm-kernel, linux-kernel, huang.junhua, guo.ziliang

From: junhua huang <huang.junhua@zte.com.cn>
After we fixed the uprobe inst endian in aarch_be, the sparse check report
the following warning info:

sparse warnings: (new ones prefixed by >>)
>> kernel/events/uprobes.c:223:25: sparse: sparse: restricted __le32 degrades to integer
>> kernel/events/uprobes.c:574:56: sparse: sparse: incorrect type in argument 4 (different base types)
@@     expected unsigned int [addressable] [usertype] opcode @@     got restricted __le32 [usertype] @@
   kernel/events/uprobes.c:574:56: sparse:     expected unsigned int [addressable] [usertype] opcode
   kernel/events/uprobes.c:574:56: sparse:     got restricted __le32 [usertype]
>> kernel/events/uprobes.c:1483:32: sparse: sparse: incorrect type in initializer (different base types)
@@     expected unsigned int [usertype] insn @@     got restricted __le32 [usertype] @@
   kernel/events/uprobes.c:1483:32: sparse:     expected unsigned int [usertype] insn
   kernel/events/uprobes.c:1483:32: sparse:     got restricted __le32 [usertype]

use the __le32 to u32 for uprobe_opcode_t, to keep the same.

Fixes: 60f07e22a73d ("arm64:uprobe fix the uprobe SWBP_INSN in big-endian")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: junhua huang <huang.junhua@zte.com.cn>
---
 arch/arm64/include/asm/uprobes.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/uprobes.h b/arch/arm64/include/asm/uprobes.h
index ba4bff5ca674..2b09495499c6 100644
--- a/arch/arm64/include/asm/uprobes.h
+++ b/arch/arm64/include/asm/uprobes.h
@@ -16,7 +16,7 @@
 #define UPROBE_SWBP_INSN_SIZE	AARCH64_INSN_SIZE
 #define UPROBE_XOL_SLOT_BYTES	MAX_UINSN_BYTES

-typedef u32 uprobe_opcode_t;
+typedef __le32 uprobe_opcode_t;

 struct arch_uprobe_task {
 };
-- 
2.15.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] arm64/uprobes: change the uprobe_opcode_t typedef to fix the sparse warning
@ 2022-12-28  1:54 guo.ziliang
  2023-01-05 18:03 ` Will Deacon
  0 siblings, 1 reply; 3+ messages in thread
From: guo.ziliang @ 2022-12-28  1:54 UTC (permalink / raw)
  To: will
  Cc: catalin.marinas, lkp, linux-arm-kernel, linux-kernel,
	huang.junhua, guo.ziliang

From: junhua huang <huang.junhua@zte.com.cn>

After we fixed the uprobe inst endian in aarch_be, the sparse check report
the following warning info:

sparse warnings: (new ones prefixed by >>)
>> kernel/events/uprobes.c:223:25: sparse: sparse: restricted __le32 degrades to integer
>> kernel/events/uprobes.c:574:56: sparse: sparse: incorrect type in argument 4 (different base types)
@@     expected unsigned int [addressable] [usertype] opcode @@     got restricted __le32 [usertype] @@
   kernel/events/uprobes.c:574:56: sparse:     expected unsigned int [addressable] [usertype] opcode
   kernel/events/uprobes.c:574:56: sparse:     got restricted __le32 [usertype]
>> kernel/events/uprobes.c:1483:32: sparse: sparse: incorrect type in initializer (different base types)
@@     expected unsigned int [usertype] insn @@     got restricted __le32 [usertype] @@
   kernel/events/uprobes.c:1483:32: sparse:     expected unsigned int [usertype] insn
   kernel/events/uprobes.c:1483:32: sparse:     got restricted __le32 [usertype]

use the __le32 to u32 for uprobe_opcode_t, to keep the same.

Fixes: 60f07e22a73d ("arm64:uprobe fix the uprobe SWBP_INSN in big-endian")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: junhua huang <huang.junhua@zte.com.cn>
---
 arch/arm64/include/asm/uprobes.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/uprobes.h b/arch/arm64/include/asm/uprobes.h
index ba4bff5ca674..2b09495499c6 100644
--- a/arch/arm64/include/asm/uprobes.h
+++ b/arch/arm64/include/asm/uprobes.h
@@ -16,7 +16,7 @@
 #define UPROBE_SWBP_INSN_SIZE	AARCH64_INSN_SIZE
 #define UPROBE_XOL_SLOT_BYTES	MAX_UINSN_BYTES

-typedef u32 uprobe_opcode_t;
+typedef __le32 uprobe_opcode_t;

 struct arch_uprobe_task {
 };
-- 
2.15.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm64/uprobes: change the uprobe_opcode_t typedef to fix the sparse warning
  2022-12-28  1:54 [PATCH] arm64/uprobes: change the uprobe_opcode_t typedef to fix the sparse warning guo.ziliang
@ 2023-01-05 18:03 ` Will Deacon
  0 siblings, 0 replies; 3+ messages in thread
From: Will Deacon @ 2023-01-05 18:03 UTC (permalink / raw)
  To: guo.ziliang
  Cc: catalin.marinas, kernel-team, Will Deacon, lkp, linux-arm-kernel,
	linux-kernel, huang.junhua

On Wed, 28 Dec 2022 09:54:12 +0800 (CST), guo.ziliang@zte.com.cn wrote:
> From: junhua huang <huang.junhua@zte.com.cn>
> 
> After we fixed the uprobe inst endian in aarch_be, the sparse check report
> the following warning info:
> 
> sparse warnings: (new ones prefixed by >>)
> >> kernel/events/uprobes.c:223:25: sparse: sparse: restricted __le32 degrades to integer
> >> kernel/events/uprobes.c:574:56: sparse: sparse: incorrect type in argument 4 (different base types)
> @@     expected unsigned int [addressable] [usertype] opcode @@     got restricted __le32 [usertype] @@
>    kernel/events/uprobes.c:574:56: sparse:     expected unsigned int [addressable] [usertype] opcode
>    kernel/events/uprobes.c:574:56: sparse:     got restricted __le32 [usertype]
> >> kernel/events/uprobes.c:1483:32: sparse: sparse: incorrect type in initializer (different base types)
> @@     expected unsigned int [usertype] insn @@     got restricted __le32 [usertype] @@
>    kernel/events/uprobes.c:1483:32: sparse:     expected unsigned int [usertype] insn
>    kernel/events/uprobes.c:1483:32: sparse:     got restricted __le32 [usertype]
> 
> [...]

Applied to arm64 (for-next/fixes), thanks!

[1/1] arm64/uprobes: change the uprobe_opcode_t typedef to fix the sparse warning
      https://git.kernel.org/arm64/c/ef08c0fadd8a

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-05 18:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-28  1:54 [PATCH] arm64/uprobes: change the uprobe_opcode_t typedef to fix the sparse warning guo.ziliang
2023-01-05 18:03 ` Will Deacon
  -- strict thread matches above, loose matches on Subject: below --
2022-12-16  8:50 guo.ziliang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox