mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	x86@kernel.org
Cc: Arnd Bergmann <arnd@arndb.de>, "H. Peter Anvin" <hpa@zytor.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] x86: fix pgprotval_t format string
Date: Tue, 10 Apr 2018 10:43:59 +0200	[thread overview]
Message-ID: <20180410084424.2935759-1-arnd@arndb.de> (raw)

On 32-bit builds, pgprotval_t can be either 32-bit or 64-bit wide depending
on the page table layout. In the latter case, we now get a build warning:

In file included from arch/x86/include/asm/bug.h:83,
                 from include/linux/bug.h:5,
                 from include/linux/crypto.h:23,
                 from arch/x86/kernel/asm-offsets.c:9:
arch/x86/include/asm/pgtable.h: In function 'check_pgprot':
arch/x86/include/asm/pgtable.h:536:5: error: format '%lx' expects argument of type 'long unsigned int', but argument 2 has type 'pgprotval_t' {aka 'long long unsigned int'} [-Werror=format=]

To work around the problem, we can always print the value as a u64,
and add the respective cast.

Fixes: 64c80759408f ("x86/mm: Do not auto-massage page protections")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/include/asm/pgtable.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h
index 50b207289ae1..5f49b4ff0c24 100644
--- a/arch/x86/include/asm/pgtable.h
+++ b/arch/x86/include/asm/pgtable.h
@@ -533,11 +533,11 @@ static inline pgprotval_t check_pgprot(pgprot_t pgprot)
 	/* mmdebug.h can not be included here because of dependencies */
 #ifdef CONFIG_DEBUG_VM
 	WARN_ONCE(pgprot_val(pgprot) != massaged_val,
-		  "attempted to set unsupported pgprot: %016lx "
-		  "bits: %016lx supported: %016lx\n",
-		  pgprot_val(pgprot),
-		  pgprot_val(pgprot) ^ massaged_val,
-		  __supported_pte_mask);
+		  "attempted to set unsupported pgprot: %016llx "
+		  "bits: %016llx supported: %016llx\n",
+		  (u64)pgprot_val(pgprot),
+		  (u64)pgprot_val(pgprot) ^ massaged_val,
+		  (u64)__supported_pte_mask);
 #endif
 
 	return massaged_val;
-- 
2.9.0

             reply	other threads:[~2018-04-10  8:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10  8:43 Arnd Bergmann [this message]
2018-04-10 20:00 ` Dave Hansen

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=20180410084424.2935759-1-arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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

all inboxes | Powered by JetHome®