All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jirislaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Peter Chubb <peterc-M3ycANVxPotyL3EAZA59ERCuuivNXqWP@public.gmane.org>
Cc: len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] `unaligned access' in acpi get_root_bridge_busnr()
Date: Thu, 20 Oct 2005 13:27:27 +0200	[thread overview]
Message-ID: <43577F1F.3070209@gmail.com> (raw)
In-Reply-To: <17239.4347.595396.783239-t0Sv2hkTHA9yuP2ZY8HSTlptZk9uqtcn@public.gmane.org>

Peter Chubb napsal(a):

>In drivers/acpi/glue.c the address of an integer is cast to the
>address of an unsigned long.  This breaks on systems where a long is
>larger than an int --- for a start the int can be misaligned; for a
>second the assignment through the pointer will overwrite part of the
>next variable.
>
>Patch is against linux-2.6.14-rc4
>
>Signed-off-by: Peter Chubb <peterc-M3ycANVxPotyL3EAZA59ERCuuivNXqWP@public.gmane.org>
>
>Index: linux-2.6-import/drivers/acpi/glue.c
>===================================================================
>--- linux-2.6-import.orig/drivers/acpi/glue.c	2005-09-09 09:08:49.928854100 +1000
>+++ linux-2.6-import/drivers/acpi/glue.c	2005-10-20 13:32:32.126445742 +1000
>@@ -89,46 +89,46 @@ static int acpi_find_bridge_device(struc
> /* Get PCI root bridge's handle from its segment and bus number */
> struct acpi_find_pci_root {
> 	unsigned int seg;
> 	unsigned int bus;
> 	acpi_handle handle;
> };
> 
> static acpi_status
> do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data)
> {
>-	int *busnr = (int *)data;
>+	unsigned long *busnr = (unsigned long *)data;
>  
>
Is the cast here really needed?

regards,

-- 
Jiri Slaby         www.fi.muni.cz/~xslaby
~\-/~      jirislaby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org      ~\-/~
B67499670407CE62ACC8 22A032CC55C339D47A7E



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl

WARNING: multiple messages have this Message-ID (diff)
From: Jiri Slaby <jirislaby@gmail.com>
To: Peter Chubb <peterc@gelato.unsw.edu.au>
Cc: len.brown@intel.com, acpi-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] `unaligned access' in acpi get_root_bridge_busnr()
Date: Thu, 20 Oct 2005 13:27:27 +0200	[thread overview]
Message-ID: <43577F1F.3070209@gmail.com> (raw)
In-Reply-To: <17239.4347.595396.783239@berry.gelato.unsw.EDU.AU>

Peter Chubb napsal(a):

>In drivers/acpi/glue.c the address of an integer is cast to the
>address of an unsigned long.  This breaks on systems where a long is
>larger than an int --- for a start the int can be misaligned; for a
>second the assignment through the pointer will overwrite part of the
>next variable.
>
>Patch is against linux-2.6.14-rc4
>
>Signed-off-by: Peter Chubb <peterc@gelato.unsw.edu.au>
>
>Index: linux-2.6-import/drivers/acpi/glue.c
>===================================================================
>--- linux-2.6-import.orig/drivers/acpi/glue.c	2005-09-09 09:08:49.928854100 +1000
>+++ linux-2.6-import/drivers/acpi/glue.c	2005-10-20 13:32:32.126445742 +1000
>@@ -89,46 +89,46 @@ static int acpi_find_bridge_device(struc
> /* Get PCI root bridge's handle from its segment and bus number */
> struct acpi_find_pci_root {
> 	unsigned int seg;
> 	unsigned int bus;
> 	acpi_handle handle;
> };
> 
> static acpi_status
> do_root_bridge_busnr_callback(struct acpi_resource *resource, void *data)
> {
>-	int *busnr = (int *)data;
>+	unsigned long *busnr = (unsigned long *)data;
>  
>
Is the cast here really needed?

regards,

-- 
Jiri Slaby         www.fi.muni.cz/~xslaby
~\-/~      jirislaby@gmail.com      ~\-/~
B67499670407CE62ACC8 22A032CC55C339D47A7E


  parent reply	other threads:[~2005-10-20 11:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-20  3:37 [PATCH] `unaligned access' in acpi get_root_bridge_busnr() Peter Chubb
2005-10-20  3:37 ` Peter Chubb
     [not found] ` <17239.4347.595396.783239-t0Sv2hkTHA9yuP2ZY8HSTlptZk9uqtcn@public.gmane.org>
2005-10-20 11:27   ` Jiri Slaby [this message]
2005-10-20 11:27     ` Jiri Slaby
2005-10-20 14:44 ` [ACPI] " Alex Williamson

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=43577F1F.3070209@gmail.com \
    --to=jirislaby-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=acpi-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org \
    --cc=len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=peterc-M3ycANVxPotyL3EAZA59ERCuuivNXqWP@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.