mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ben Hutchings <ben@decadent.org.uk>
To: Artem Savkov <artem.savkov@gmail.com>
Cc: tmhikaru@gmail.com, akpm@linux-foundation.org,
	zhenzhong.duan@oracle.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dmi_scan: proper buf type in dmi_present()
Date: Thu, 14 Mar 2013 00:31:53 +0000	[thread overview]
Message-ID: <1363221113.3937.101.camel@deadeye.wl.decadent.org.uk> (raw)
In-Reply-To: <1363119427-4371-1-git-send-email-artem.savkov@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2326 bytes --]

On Wed, 2013-03-13 at 00:17 +0400, Artem Savkov wrote:
> buf needs to be unsigned in dmi_present(), otherwise dmi_base calculation
> doesn't work properly leading to a wraparound during dmi_ioremap:
> 
> [    0.000000] ------------[ cut here ]------------
> [    0.000000] WARNING: at arch/x86/mm/ioremap.c:524 __early_ioremap+0x85/0x18a()
> [    0.000000] Modules linked in:
> [    0.000000] Pid: 0, comm: swapper Not tainted 3.9.0-rc2-next-20130312 #283
> [    0.000000] Call Trace:
> [    0.000000]  [<c1036992>] warn_slowpath_common+0x72/0xa0
> [    0.000000]  [<c19cc176>] ? __early_ioremap+0x85/0x18a
> [    0.000000]  [<c19cc176>] ? __early_ioremap+0x85/0x18a
> [    0.000000]  [<c10369e2>] warn_slowpath_null+0x22/0x30
> [    0.000000]  [<c19cc176>] __early_ioremap+0x85/0x18a
> [    0.000000]  [<c19cc1ed>] ? __early_ioremap+0xfc/0x18a
> [    0.000000]  [<c19cc412>] early_ioremap+0xd/0xf
> [    0.000000]  [<c19fbba9>] dmi_present+0xf5/0x22a
> [    0.000000]  [<c19fbd9d>] dmi_scan_machine+0xbf/0x11c
> [    0.000000]  [<c19bd781>] setup_arch+0x4db/0xca0
> [    0.000000]  [<c168105c>] ? printk+0x3d/0x3f
> [    0.000000]  [<c19ba763>] start_kernel+0x7b/0x329
> [    0.000000]  [<c19ba361>] i386_start_kernel+0x137/0x13a
> [    0.000000] ---[ end trace 4eaa2a86a8e2da22 ]---
> [    0.000000] DMI not present or invalid.
> 
> Introduced in "dmi_scan: refactor dmi_scan_machine(), {smbios,dmi}_present()"
> 
> Signed-off-by: Artem Savkov <artem.savkov@gmail.com>
Acked-by: Ben Hutchings <ben@decadent.org.uk>

Wow, this is a pretty obvious fix.  Somehow this code did work for at
least two of us, so I suppose we were (un)lucky to have bit 7 clear on
all the critical bytes!

Ben.

> ---
>  drivers/firmware/dmi_scan.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
> index 3439f59..40e940d 100644
> --- a/drivers/firmware/dmi_scan.c
> +++ b/drivers/firmware/dmi_scan.c
> @@ -410,7 +410,7 @@ static void __init dmi_dump_ids(void)
>  	printk(KERN_CONT "\n");
>  }
>  
> -static int __init dmi_present(const char *buf)
> +static int __init dmi_present(const u8 *buf)
>  {
>  	int smbios_ver;
>  

-- 
Ben Hutchings
Humans are not rational beings; they are rationalising beings.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

      reply	other threads:[~2013-03-14  0:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-12 20:17 Artem Savkov
2013-03-14  0:31 ` Ben Hutchings [this message]

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=1363221113.3937.101.camel@deadeye.wl.decadent.org.uk \
    --to=ben@decadent.org.uk \
    --cc=akpm@linux-foundation.org \
    --cc=artem.savkov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tmhikaru@gmail.com \
    --cc=zhenzhong.duan@oracle.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

all inboxes | Powered by JetHome®