linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] jump_label: Fix sparc64 warning
@ 2018-03-14 15:24 Josh Poimboeuf
  2018-03-14 15:40 ` [tip:x86/pti] " tip-bot for Josh Poimboeuf
  2018-03-14 16:46 ` [PATCH] " David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Josh Poimboeuf @ 2018-03-14 15:24 UTC (permalink / raw)
  To: x86
  Cc: linux-kernel, Ingo Molnar, David S . Miller, Peter Zijlstra,
	Jason Baron, Borislav Petkov

The kbuild test robot reported the following warning on sparc64:

  kernel/jump_label.c: In function '__jump_label_update':
  kernel/jump_label.c:376:51: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       WARN_ONCE(1, "can't patch jump_label at %pS", (void *)entry->code);

On sparc64, the jump_label entry->code field is of type u32, but
pointers are 64-bit.  Silence the warning by casting entry->code to an
unsigned long before casting it to a pointer.  This is also what the
sparc jump label code does.

Reported-by: kbuild test robot <fengguang.wu@intel.com>
Fixes: dc1dd184c2f0 ("jump_label: Warn on failed jump_label patching attempt")
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
---
 kernel/jump_label.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index 52a0a7af8640..e7214093dcd1 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -373,7 +373,8 @@ static void __jump_label_update(struct static_key *key,
 			if (kernel_text_address(entry->code))
 				arch_jump_label_transform(entry, jump_label_type(entry));
 			else
-				WARN_ONCE(1, "can't patch jump_label at %pS", (void *)entry->code);
+				WARN_ONCE(1, "can't patch jump_label at %pS",
+					  (void *)(unsigned long)entry->code);
 		}
 	}
 }
-- 
2.14.3

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

* [tip:x86/pti] jump_label: Fix sparc64 warning
  2018-03-14 15:24 [PATCH] jump_label: Fix sparc64 warning Josh Poimboeuf
@ 2018-03-14 15:40 ` tip-bot for Josh Poimboeuf
  2018-03-14 16:46 ` [PATCH] " David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Josh Poimboeuf @ 2018-03-14 15:40 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: fengguang.wu, jbaron, linux-kernel, davem, bp, peterz, tglx, hpa,
	jpoimboe, mingo

Commit-ID:  af1d830bf32b27b387b97c8b29dc09e306a9ff7f
Gitweb:     https://git.kernel.org/tip/af1d830bf32b27b387b97c8b29dc09e306a9ff7f
Author:     Josh Poimboeuf <jpoimboe@redhat.com>
AuthorDate: Wed, 14 Mar 2018 10:24:20 -0500
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Wed, 14 Mar 2018 16:35:26 +0100

jump_label: Fix sparc64 warning

The kbuild test robot reported the following warning on sparc64:

  kernel/jump_label.c: In function '__jump_label_update':
  kernel/jump_label.c:376:51: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       WARN_ONCE(1, "can't patch jump_label at %pS", (void *)entry->code);

On sparc64, the jump_label entry->code field is of type u32, but
pointers are 64-bit.  Silence the warning by casting entry->code to an
unsigned long before casting it to a pointer.  This is also what the
sparc jump label code does.

Fixes: dc1dd184c2f0 ("jump_label: Warn on failed jump_label patching attempt")
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Jason Baron <jbaron@akamai.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: "David S . Miller" <davem@davemloft.net>
Link: https://lkml.kernel.org/r/c966fed42be6611254a62d46579ec7416548d572.1521041026.git.jpoimboe@redhat.com

---
 kernel/jump_label.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/jump_label.c b/kernel/jump_label.c
index 52a0a7af8640..e7214093dcd1 100644
--- a/kernel/jump_label.c
+++ b/kernel/jump_label.c
@@ -373,7 +373,8 @@ static void __jump_label_update(struct static_key *key,
 			if (kernel_text_address(entry->code))
 				arch_jump_label_transform(entry, jump_label_type(entry));
 			else
-				WARN_ONCE(1, "can't patch jump_label at %pS", (void *)entry->code);
+				WARN_ONCE(1, "can't patch jump_label at %pS",
+					  (void *)(unsigned long)entry->code);
 		}
 	}
 }

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

* Re: [PATCH] jump_label: Fix sparc64 warning
  2018-03-14 15:24 [PATCH] jump_label: Fix sparc64 warning Josh Poimboeuf
  2018-03-14 15:40 ` [tip:x86/pti] " tip-bot for Josh Poimboeuf
@ 2018-03-14 16:46 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-03-14 16:46 UTC (permalink / raw)
  To: jpoimboe; +Cc: x86, linux-kernel, mingo, peterz, jbaron, bp

From: Josh Poimboeuf <jpoimboe@redhat.com>
Date: Wed, 14 Mar 2018 10:24:20 -0500

> The kbuild test robot reported the following warning on sparc64:
> 
>   kernel/jump_label.c: In function '__jump_label_update':
>   kernel/jump_label.c:376:51: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
>        WARN_ONCE(1, "can't patch jump_label at %pS", (void *)entry->code);
> 
> On sparc64, the jump_label entry->code field is of type u32, but
> pointers are 64-bit.  Silence the warning by casting entry->code to an
> unsigned long before casting it to a pointer.  This is also what the
> sparc jump label code does.
> 
> Reported-by: kbuild test robot <fengguang.wu@intel.com>
> Fixes: dc1dd184c2f0 ("jump_label: Warn on failed jump_label patching attempt")
> Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>

Acked-by: David S. Miller <davem@davemloft.net>

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

end of thread, other threads:[~2018-03-14 16:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-14 15:24 [PATCH] jump_label: Fix sparc64 warning Josh Poimboeuf
2018-03-14 15:40 ` [tip:x86/pti] " tip-bot for Josh Poimboeuf
2018-03-14 16:46 ` [PATCH] " David Miller

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