linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86: define LOADED_MM_SWITCHING with pointer-sized number
@ 2019-03-28 23:09 Jann Horn
  2019-03-29  7:32 ` Mukesh Ojha
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jann Horn @ 2019-03-28 23:09 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin, jannh
  Cc: x86, linux-kernel, Andy Lutomirski

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.

Signed-off-by: Jann Horn <jannh@google.com>
---
 arch/x86/include/asm/tlbflush.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h
index f4204bf377fc..90926e8dd1f8 100644
--- a/arch/x86/include/asm/tlbflush.h
+++ b/arch/x86/include/asm/tlbflush.h
@@ -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 {
-- 
2.21.0.392.gf8f6787159e-goog


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

* Re: [PATCH] x86: define LOADED_MM_SWITCHING with pointer-sized number
  2019-03-28 23:09 [PATCH] x86: define LOADED_MM_SWITCHING with pointer-sized number Jann Horn
@ 2019-03-29  7:32 ` Mukesh Ojha
  2019-03-29 13:57 ` Borislav Petkov
  2019-03-29 14:04 ` [tip:x86/cleanups] x86/mm/tlb: Define " tip-bot for Jann Horn
  2 siblings, 0 replies; 5+ messages in thread
From: Mukesh Ojha @ 2019-03-29  7:32 UTC (permalink / raw)
  To: Jann Horn, Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin
  Cc: x86, linux-kernel, Andy Lutomirski


On 3/29/2019 4:39 AM, Jann Horn wrote:
> 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.
>
> Signed-off-by: Jann Horn <jannh@google.com>


Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>

-Mukesh

> ---
>   arch/x86/include/asm/tlbflush.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h
> index f4204bf377fc..90926e8dd1f8 100644
> --- a/arch/x86/include/asm/tlbflush.h
> +++ b/arch/x86/include/asm/tlbflush.h
> @@ -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 {

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

* Re: [PATCH] x86: define LOADED_MM_SWITCHING with pointer-sized number
  2019-03-28 23:09 [PATCH] x86: define LOADED_MM_SWITCHING with pointer-sized number Jann Horn
  2019-03-29  7:32 ` Mukesh Ojha
@ 2019-03-29 13:57 ` Borislav Petkov
  2019-03-29 14:47   ` Jann Horn
  2019-03-29 14:04 ` [tip:x86/cleanups] x86/mm/tlb: Define " tip-bot for Jann Horn
  2 siblings, 1 reply; 5+ messages in thread
From: Borislav Petkov @ 2019-03-29 13:57 UTC (permalink / raw)
  To: Jann Horn
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, linux-kernel,
	Andy Lutomirski

> 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.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

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

* [tip:x86/cleanups] x86/mm/tlb: Define LOADED_MM_SWITCHING with pointer-sized number
  2019-03-28 23:09 [PATCH] x86: define LOADED_MM_SWITCHING with pointer-sized number Jann Horn
  2019-03-29  7:32 ` Mukesh Ojha
  2019-03-29 13:57 ` Borislav Petkov
@ 2019-03-29 14:04 ` tip-bot for Jann Horn
  2 siblings, 0 replies; 5+ messages in thread
From: tip-bot for Jann Horn @ 2019-03-29 14:04 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mingo, linux-kernel, mingo, luto, sai.praneeth.prakhya, peterz,
	bigeasy, x86, hpa, mojha, dave.hansen, jannh, tglx, bp, riel

Commit-ID:  a72a19327b92e09dab0eb9fd2bc83466465cbffb
Gitweb:     https://git.kernel.org/tip/a72a19327b92e09dab0eb9fd2bc83466465cbffb
Author:     Jann Horn <jannh@google.com>
AuthorDate: Fri, 29 Mar 2019 00:09:39 +0100
Committer:  Borislav Petkov <bp@suse.de>
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.

Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Sai Praneeth <sai.praneeth.prakhya@intel.com>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: x86-ml <x86@kernel.org>
Link: https://lkml.kernel.org/r/20190328230939.15711-1-jannh@google.com
---
 arch/x86/include/asm/tlbflush.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h
index f4204bf377fc..90926e8dd1f8 100644
--- a/arch/x86/include/asm/tlbflush.h
+++ b/arch/x86/include/asm/tlbflush.h
@@ -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 {

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

* Re: [PATCH] x86: define LOADED_MM_SWITCHING with pointer-sized number
  2019-03-29 13:57 ` Borislav Petkov
@ 2019-03-29 14:47   ` Jann Horn
  0 siblings, 0 replies; 5+ messages in thread
From: Jann Horn @ 2019-03-29 14:47 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	the arch/x86 maintainers, kernel list, Andy Lutomirski

On Fri, Mar 29, 2019 at 2:57 PM Borislav Petkov <bp@alien8.de> wrote:
>
> > 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.

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

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

end of thread, other threads:[~2019-03-29 14:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-28 23:09 [PATCH] x86: define LOADED_MM_SWITCHING with pointer-sized number Jann Horn
2019-03-29  7:32 ` Mukesh Ojha
2019-03-29 13:57 ` Borislav Petkov
2019-03-29 14:47   ` Jann Horn
2019-03-29 14:04 ` [tip:x86/cleanups] x86/mm/tlb: Define " tip-bot for Jann Horn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).