From: "H. Peter Anvin" <hpa@zytor.com>
To: Tony Luck <tony.luck@intel.com>
Cc: Yinghai Lu <yhlu.kernel@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>,
tglx@linutronix.de, jbarnes@virtuousgeek.org,
torvalds@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: split e820 reserved entries record to late v4 - fix v7
Date: Mon, 13 Oct 2008 14:14:16 -0700 [thread overview]
Message-ID: <48F3BA28.2010605@zytor.com> (raw)
In-Reply-To: <12c511ca0810131332h6e5468abk3dfc511f0b25cbe6@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1177 bytes --]
Tony Luck wrote:
> On Thu, Sep 4, 2008 at 12:22 PM, Yinghai Lu <yhlu.kernel@gmail.com> wrote:
>> On Thu, Sep 4, 2008 at 12:16 PM, Andrew Morton
>> <akpm@linux-foundation.org> wrote:
>>> On Thu, 4 Sep 2008 21:04:57 +0200
>>> Ingo Molnar <mingo@elte.hu> wrote:
>>>
>>>> + printk(KERN_DEBUG " __reserve_region_with_split: (%s) [%llx, %llx], res: (%s) [%llx, %llx]\n",
>>>> + conflict->name, conflict->start, conflict->end,
>>>> + name, start, end);
>>> start and end have type resource_size_t. Such types CANNOT be printed
>>> unless cast to a known type.
>>>
>>> Because there is a %s following an incorrect %lld, the above code will
>>> crash the machine.
>> should just remove those lines.
>
> This didn't happen. These lines are still in the version that went into
> Linus' tree over the weekend for 2.6.28. On the ia64 build they spit
> out a bunch of warnings:
>
> kernel/resource.c:554: warning: format '%llx' expects type 'long long
> unsigned int', but argument 3 has type 'resource_size_t'
>
> Ditto for args 4, 6 and 7 on the same line.
>
Here is a fix... currently running standard tests on it.
-hpa
[-- Attachment #2: 0001-resource-fix-printk-of-resource_size_t.patch --]
[-- Type: text/x-patch, Size: 1317 bytes --]
>From 2d7c0377c3c98d2605704e67e64d1d19aa30ced3 Mon Sep 17 00:00:00 2001
From: H. Peter Anvin <hpa@zytor.com>
Date: Mon, 13 Oct 2008 14:11:03 -0700
Subject: [PATCH] resource: fix printk() of resource_size_t
Impact: crash on 32-bit platforms, warnings on 64-bit platforms
When printk'ing resource_size_t, we have to explicitly cast them to
unsigned long long in order to be safe on all platforms. We must not use
%z since that applies to size_t, which is frequently not the same type
as resource_size_t.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
kernel/resource.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/resource.c b/kernel/resource.c
index 414d6fc..f747fb6 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -550,8 +550,12 @@ static void __init __reserve_region_with_split(struct resource *root,
if (!res) {
printk(KERN_DEBUG " __reserve_region_with_split: (%s) [%llx, %llx], res: (%s) [%llx, %llx]\n",
- conflict->name, conflict->start, conflict->end,
- name, start, end);
+ conflict->name,
+ (unsigned long long)conflict->start,
+ (unsigned long long)conflict->end,
+ name,
+ (unsigned long long)start,
+ (unsigned long long)end);
/* failed, split and try again */
--
1.6.0.2
next prev parent reply other threads:[~2008-10-13 21:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-01 7:31 [PATCH] x86: split e820 reserved entries record to late v4 - fix v7 Yinghai Lu
2008-09-04 19:04 ` Ingo Molnar
2008-09-04 19:16 ` Andrew Morton
2008-09-04 19:22 ` Yinghai Lu
2008-10-13 20:32 ` Tony Luck
2008-10-13 21:14 ` H. Peter Anvin [this message]
2008-10-13 21:17 ` Luck, Tony
2008-10-13 21:46 ` Linus Torvalds
2008-10-13 21:54 ` H. Peter Anvin
2008-10-13 22:40 ` Yinghai Lu
2008-10-13 22:48 ` H. Peter Anvin
2008-10-14 5:29 ` Yinghai Lu
2008-09-05 8:52 ` Yinghai Lu
2008-09-05 11:45 ` Ingo Molnar
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=48F3BA28.2010605@zytor.com \
--to=hpa@zytor.com \
--cc=akpm@linux-foundation.org \
--cc=jbarnes@virtuousgeek.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=tony.luck@intel.com \
--cc=torvalds@linux-foundation.org \
--cc=yhlu.kernel@gmail.com \
/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