- Subject: Re: [PATCH v2 2/5] firmware: Basic dmi-sysfs support
- From: Tony Luck <tony.luck@xxxxxxxxx>
- Date: Wed, 23 Feb 2011 13:29:46 -0800
- Cc: Greg KH <greg@xxxxxxxxx>, Olof Johansson <olofj@xxxxxxxxxxxx>, Andi Kleen <andi@xxxxxxxxxxxxxx>, Alan Cox <alan@xxxxxxxxxxxxxxxxxxx>, Robert Lippert <rlippert@xxxxxxxxxx>, Jon Mayer <jonmayer@xxxxxxxxxx>, Duncan Laurie <dlaurie@xxxxxxxxxx>, Aaron Durbin <adurbin@xxxxxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, Tim Hockin <thockin@xxxxxxxxxx>, David Hendrix <dhendrix@xxxxxxxxxxxx>, linux-api@xxxxxxxxxxxxxxx
- In-reply-to: <AANLkTi=+-Wc0bWdpvR+X6UszLf7MXKYgi8Oo6anN-jR8@xxxxxxxxxxxxxx>
- References: <20110223015307.13068.14063.stgit@xxxxxxxxxxxxxxxxxxxxxxxx> <20110223015320.13068.77428.stgit@xxxxxxxxxxxxxxxxxxxxxxxx> <AANLkTinjhY3oiFTq2xq4fwQ-mtLZ8ph435+nc5irM7wZ@xxxxxxxxxxxxxx> <AANLkTi=+-Wc0bWdpvR+X6UszLf7MXKYgi8Oo6anN-jR8@xxxxxxxxxxxxxx>
On Wed, Feb 23, 2011 at 12:28 PM, Mike Waychison <mikew@xxxxxxxxxx> wrote:
> Ya, I don't think there is anything that guarantees that dmi_header is
> aligned. The access is probably the struct copy I did here:
>
> /* Set the key */
> entry->dh = *dh;
Yup - looking back at the assembly I see that one of the 2-byte
accesses is offset 2
(picking up ->handle), but the second is offset 0 (picking up ->type
and ->length). The
compiler assumed the structure was 2-byte aligned because of ->handle.
> What if we changed that guy to use memcpy? We'd probably need to
> memcpy the dmi_system_event_log as well. Patch attached (applies on
> top of the entire patchset).
With the patch, all the unaligned accesses go away.
Tested-by: Tony Luck <tony.luck@xxxxxxxxx>
-Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-api" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
[Home]
[Linux USB Devel]
[Video for Linux]
[Linux Audio Users]
[Photo]
[Yosemite News]
[Yosemite Photos]
[Free Online Dating]
[Linux Kernel]
[Linux SCSI]
[XFree86]