Thread (14 messages) flat view 14 messages, 3 authors, 2011-02-25

Re: [PATCH v2 2/5] firmware: Basic dmi-sysfs support

From: Tony Luck <hidden>
Date: 2011-02-23 21:29:49
Also in: lkml

On Wed, Feb 23, 2011 at 12:28 PM, Mike Waychison [off-list ref] 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 <redacted>

-Tony
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help