Skip to contentSkip to conversation

x86: define LOADED_MM_SWITCHING with pointer-sized number

PATCH In review Jann Horn 4 participants 5 messages Mar 28, 2019 – Mar 29, 2019 x86

lore
Share & tools
lore

Jann Horn

author
#0 lore raw

PATCH 1/1 x86: define LOADED_MM_SWITCHING with pointer-sized number

sparse complains that LOADED_MM_SWITCHING's definition casts an int to a pointer:

arch/x86/mm/tlb.c:409:17: warning: non size-preserving integer to pointer cast

Use a pointer-sized integer constant instead.

---
 arch/x86/include/asm/tlbflush.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/tlbflush.h +1 -1
index f4204bf377fc..90926e8dd1f8 100644
@@ -167,7 +167,7 @@ struct tlb_state {
 	 */
 	struct mm_struct *loaded_mm;
 
-#define LOADED_MM_SWITCHING ((struct mm_struct *)1)
+#define LOADED_MM_SWITCHING ((struct mm_struct *)1UL)
 
 	/* Last user mm for optimizing IBPB */
 	union {
Signature · 1 line
2.21.0.392.gf8f6787159e-goog
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Jann Horn

sparse complains that LOADED_MM_SWITCHING's definition casts an int to a pointer:

arch/x86/mm/tlb.c:409:17: warning: non size-preserving integer to pointer cast

Use a pointer-sized integer constant instead.

-Mukesh

Quoted 17 lines
---
  arch/x86/include/asm/tlbflush.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/tlbflush.h +1 -1
index f4204bf377fc..90926e8dd1f8 100644
@@ -167,7 +167,7 @@ struct tlb_state {
  	 */
  	struct mm_struct *loaded_mm;
 
-#define LOADED_MM_SWITCHING ((struct mm_struct *)1)
+#define LOADED_MM_SWITCHING ((struct mm_struct *)1UL)
 
  	/* Last user mm for optimizing IBPB */
  	union {
maintainer
#2 lore raw
In reply to Jann Horn
Quoted 1 line

Subject: Re: [PATCH] x86: define LOADED_MM_SWITCHING with pointer-sized number

For the future:

The tip tree preferred format for patch subject prefixes is 'subsys/component:', e.g. 'x86/apic:', 'x86/mm/fault:', 'sched/fair:', 'genirq/core:'. Please do not use file names or complete file paths as prefix. 'git log path/to/file' should give you a reasonable hint in most cases.

The condensed patch description in the subject line should start with a uppercase letter and should be written in imperative tone.

I've fixed it up now.

Signature · 4 lines
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.
author
#3 lore raw
Quoted 11 lines · Borislav Petkov
Quoted 2 lines

Subject: Re: [PATCH] x86: define LOADED_MM_SWITCHING with pointer-sized number

For the future:

The tip tree preferred format for patch subject prefixes is 'subsys/component:', e.g. 'x86/apic:', 'x86/mm/fault:', 'sched/fair:', 'genirq/core:'. Please do not use file names or complete file paths as prefix. 'git log path/to/file' should give you a reasonable hint in most cases.

Quoted 4 lines

The condensed patch description in the subject line should start with a uppercase letter and should be written in imperative tone.

I've fixed it up now.

Ah, thanks. I'll write that down somewhere...

#4 lore raw

[tip:x86/cleanups] x86/mm/tlb: Define LOADED_MM_SWITCHING with pointer-sized number

In reply to Jann Horn
x86/mm/tlb: Define LOADED_MM_SWITCHING with pointer-sized number
Commit-ID:  a72a19327b92e09dab0eb9fd2bc83466465cbffb
Gitweb:     https://git.kernel.org/tip/a72a19327b92e09dab0eb9fd2bc83466465cbffb
Author:     Jann Horn <[email protected]>
AuthorDate: Fri, 29 Mar 2019 00:09:39 +0100
Committer:  Borislav Petkov <[email protected]>
CommitDate: Fri, 29 Mar 2019 14:55:31 +0100

x86/mm/tlb: Define LOADED_MM_SWITCHING with pointer-sized number

sparse complains that LOADED_MM_SWITCHING's definition casts an int to a pointer:

arch/x86/mm/tlb.c:409:17: warning: non size-preserving integer to pointer cast

Use a pointer-sized integer constant instead.

Cc Andy Lutomirski <[email protected]>
Cc Dave Hansen <[email protected]>
Cc "H. Peter Anvin" <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Sai Praneeth <[email protected]>
Cc Sebastian Andrzej Siewior <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc x86-ml <[email protected]>
---
 arch/x86/include/asm/tlbflush.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/tlbflush.h +1 -1
index f4204bf377fc..90926e8dd1f8 100644
@@ -167,7 +167,7 @@ struct tlb_state {
 	 */
 	struct mm_struct *loaded_mm;
 
-#define LOADED_MM_SWITCHING ((struct mm_struct *)1)
+#define LOADED_MM_SWITCHING ((struct mm_struct *)1UL)
 
 	/* Last user mm for optimizing IBPB */
 	union {