linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix 32-bit compile warning from printk()
@ 2013-01-28 19:19 Dave Hansen
  2013-01-29 10:54 ` Andrew Morton
  2013-02-13 16:31 ` Randy Dunlap
  0 siblings, 2 replies; 5+ messages in thread
From: Dave Hansen @ 2013-01-28 19:19 UTC (permalink / raw)
  To: linux-kernel; +Cc: H. Peter Anvin, Dave Hansen


My patch "Fix kvm's use of __pa() on percpu areas" introduced a
compile warning:

arch/x86/kernel/kvm.c: In function 'kvm_register_steal_time':
arch/x86/kernel/kvm.c:302:3: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat]

According to: Documentation/printk-formats.txt

	If <type> is dependent on a config option for its size
	(e.g., phys_addr_t) ... use a format specifier of its
	largest possible type and explicitly cast to it.

So, we'll do just that.  We will consider it an unsigned long
long, and cast to it explicitly.

Signed-off-by: Dave Hansen <dave@linux.vnet.ibm.com>
---

 linux-2.6.git-dave/arch/x86/kernel/kvm.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff -puN arch/x86/kernel/kvm.c~fix-32-bit-compile-warning arch/x86/kernel/kvm.c
--- linux-2.6.git/arch/x86/kernel/kvm.c~fix-32-bit-compile-warning	2013-01-28 11:16:39.786938232 -0800
+++ linux-2.6.git-dave/arch/x86/kernel/kvm.c	2013-01-28 11:16:39.790938273 -0800
@@ -298,8 +298,8 @@ static void kvm_register_steal_time(void
 	memset(st, 0, sizeof(*st));
 
 	wrmsrl(MSR_KVM_STEAL_TIME, (slow_virt_to_phys(st) | KVM_MSR_ENABLED));
-	printk(KERN_INFO "kvm-stealtime: cpu %d, msr %lx\n",
-		cpu, slow_virt_to_phys(st));
+	printk(KERN_INFO "kvm-stealtime: cpu %d, msr %llx\n",
+		cpu, (unsigned long long)slow_virt_to_phys(st));
 }
 
 static DEFINE_PER_CPU(unsigned long, kvm_apic_eoi) = KVM_PV_EOI_DISABLED;
_


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

* Re: [PATCH] fix 32-bit compile warning from printk()
  2013-01-28 19:19 [PATCH] fix 32-bit compile warning from printk() Dave Hansen
@ 2013-01-29 10:54 ` Andrew Morton
  2013-01-29 10:55   ` Andrew Morton
  2013-02-13 16:31 ` Randy Dunlap
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Morton @ 2013-01-29 10:54 UTC (permalink / raw)
  To: Dave Hansen; +Cc: linux-kernel, H. Peter Anvin

On Mon, 28 Jan 2013 11:19:39 -0800 Dave Hansen <dave@linux.vnet.ibm.com> wrote:

> My patch "Fix kvm's use of __pa() on percpu areas" introduced a
> compile warning:
> 
> arch/x86/kernel/kvm.c: In function 'kvm_register_steal_time':
> arch/x86/kernel/kvm.c:302:3: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat]
> 
> According to: Documentation/printk-formats.txt
> 
> 	If <type> is dependent on a config option for its size
> 	(e.g., phys_addr_t) ... use a format specifier of its
> 	largest possible type and explicitly cast to it.
> 
> So, we'll do just that.  We will consider it an unsigned long
> long, and cast to it explicitly.

Please note that I have
http://ozlabs.org/~akpm/mmots/broken-out/lib-vsprintf-add-%25pa-format-specifier-for-phys_addr_t-types.patch
queued for 3.8.



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

* Re: [PATCH] fix 32-bit compile warning from printk()
  2013-01-29 10:54 ` Andrew Morton
@ 2013-01-29 10:55   ` Andrew Morton
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2013-01-29 10:55 UTC (permalink / raw)
  To: Dave Hansen, linux-kernel, H. Peter Anvin

On Tue, 29 Jan 2013 02:54:28 -0800 Andrew Morton <akpm@linux-foundation.org> wrote:

> On Mon, 28 Jan 2013 11:19:39 -0800 Dave Hansen <dave@linux.vnet.ibm.com> wrote:
> 
> > My patch "Fix kvm's use of __pa() on percpu areas" introduced a
> > compile warning:
> > 
> > arch/x86/kernel/kvm.c: In function 'kvm_register_steal_time':
> > arch/x86/kernel/kvm.c:302:3: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat]
> > 
> > According to: Documentation/printk-formats.txt
> > 
> > 	If <type> is dependent on a config option for its size
> > 	(e.g., phys_addr_t) ... use a format specifier of its
> > 	largest possible type and explicitly cast to it.
> > 
> > So, we'll do just that.  We will consider it an unsigned long
> > long, and cast to it explicitly.
> 
> Please note that I have
> http://ozlabs.org/~akpm/mmots/broken-out/lib-vsprintf-add-%25pa-format-specifier-for-phys_addr_t-types.patch
> queued for 3.8.
> 

err, I meant 3.9.  

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

* Re: [PATCH] fix 32-bit compile warning from printk()
  2013-01-28 19:19 [PATCH] fix 32-bit compile warning from printk() Dave Hansen
  2013-01-29 10:54 ` Andrew Morton
@ 2013-02-13 16:31 ` Randy Dunlap
  2013-02-13 16:39   ` Borislav Petkov
  1 sibling, 1 reply; 5+ messages in thread
From: Randy Dunlap @ 2013-02-13 16:31 UTC (permalink / raw)
  To: Dave Hansen; +Cc: linux-kernel, H. Peter Anvin, KVM

On 01/28/13 11:19, Dave Hansen wrote:
> My patch "Fix kvm's use of __pa() on percpu areas" introduced a
> compile warning:
> 
> arch/x86/kernel/kvm.c: In function 'kvm_register_steal_time':
> arch/x86/kernel/kvm.c:302:3: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'phys_addr_t' [-Wformat]
> 
> According to: Documentation/printk-formats.txt
> 
> 	If <type> is dependent on a config option for its size
> 	(e.g., phys_addr_t) ... use a format specifier of its
> 	largest possible type and explicitly cast to it.
> 
> So, we'll do just that.  We will consider it an unsigned long
> long, and cast to it explicitly.
> 
> Signed-off-by: Dave Hansen <dave@linux.vnet.ibm.com>

This warning is still present in linux-next (20130213).

Acked-by: Randy Dunlap <rdunlap@infradead.org>

Thanks.

Someone please merge...  (kvm@ cc added)

> ---
> 
>  linux-2.6.git-dave/arch/x86/kernel/kvm.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff -puN arch/x86/kernel/kvm.c~fix-32-bit-compile-warning arch/x86/kernel/kvm.c
> --- linux-2.6.git/arch/x86/kernel/kvm.c~fix-32-bit-compile-warning	2013-01-28 11:16:39.786938232 -0800
> +++ linux-2.6.git-dave/arch/x86/kernel/kvm.c	2013-01-28 11:16:39.790938273 -0800
> @@ -298,8 +298,8 @@ static void kvm_register_steal_time(void
>  	memset(st, 0, sizeof(*st));
>  
>  	wrmsrl(MSR_KVM_STEAL_TIME, (slow_virt_to_phys(st) | KVM_MSR_ENABLED));
> -	printk(KERN_INFO "kvm-stealtime: cpu %d, msr %lx\n",
> -		cpu, slow_virt_to_phys(st));
> +	printk(KERN_INFO "kvm-stealtime: cpu %d, msr %llx\n",
> +		cpu, (unsigned long long)slow_virt_to_phys(st));
>  }
>  
>  static DEFINE_PER_CPU(unsigned long, kvm_apic_eoi) = KVM_PV_EOI_DISABLED;
> _



-- 
~Randy

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

* Re: [PATCH] fix 32-bit compile warning from printk()
  2013-02-13 16:31 ` Randy Dunlap
@ 2013-02-13 16:39   ` Borislav Petkov
  0 siblings, 0 replies; 5+ messages in thread
From: Borislav Petkov @ 2013-02-13 16:39 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Dave Hansen, linux-kernel, H. Peter Anvin, KVM

On Wed, Feb 13, 2013 at 08:31:00AM -0800, Randy Dunlap wrote:
> This warning is still present in linux-next (20130213).
> 
> Acked-by: Randy Dunlap <rdunlap@infradead.org>
> 
> Thanks.
> 
> Someone please merge...  (kvm@ cc added)

There's a fix already in tip for this:

http://git.kernel.org/tip/136867f517cbc3f8a91f035677911a6b503c3323

which needs to change again once the %pa printk stuff get merged.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

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

end of thread, other threads:[~2013-02-13 16:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-28 19:19 [PATCH] fix 32-bit compile warning from printk() Dave Hansen
2013-01-29 10:54 ` Andrew Morton
2013-01-29 10:55   ` Andrew Morton
2013-02-13 16:31 ` Randy Dunlap
2013-02-13 16:39   ` Borislav Petkov

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