linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Hansen <dave@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>, Dave Hansen <dave@linux.vnet.ibm.com>
Subject: [PATCH] fix 32-bit compile warning from printk()
Date: Mon, 28 Jan 2013 11:19:39 -0800	[thread overview]
Message-ID: <20130128191939.7F67966B@kernel.stglabs.ibm.com> (raw)


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;
_


             reply	other threads:[~2013-01-28 19:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-28 19:19 Dave Hansen [this message]
2013-01-29 10:54 ` [PATCH] fix 32-bit compile warning from printk() Andrew Morton
2013-01-29 10:55   ` Andrew Morton
2013-02-13 16:31 ` Randy Dunlap
2013-02-13 16:39   ` Borislav Petkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130128191939.7F67966B@kernel.stglabs.ibm.com \
    --to=dave@linux.vnet.ibm.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).