From: Tony Luck <tony.luck-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Mike Waychison <mikew-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: Greg KH <greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>,
Olof Johansson <olofj-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
Andi Kleen <andi-Vw/NltI1exuRpAAqCnN02g@public.gmane.org>,
Alan Cox <alan-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org>,
Robert Lippert <rlippert-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Jon Mayer <jonmayer-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Duncan Laurie <dlaurie-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Aaron Durbin <adurbin-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Tim Hockin <thockin-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
David Hendrix <dhendrix-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2 2/5] firmware: Basic dmi-sysfs support
Date: Wed, 23 Feb 2011 13:29:46 -0800 [thread overview]
Message-ID: <AANLkTi=dE5_VjJ+5H6cWf9nAtdkLiqhSXo6Gvd_uGQ25@mail.gmail.com> (raw)
In-Reply-To: <AANLkTi=+-Wc0bWdpvR+X6UszLf7MXKYgi8Oo6anN-jR8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Wed, Feb 23, 2011 at 12:28 PM, Mike Waychison <mikew-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> 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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
-Tony
next prev parent reply other threads:[~2011-02-23 21:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-23 1:53 [PATCH v2 0/5] Exporting DMI entries via sysfs Mike Waychison
2011-02-23 1:53 ` [PATCH v2 1/5] firmware: Add DMI entry types to the headers Mike Waychison
2011-02-23 1:53 ` [PATCH v2 2/5] firmware: Basic dmi-sysfs support Mike Waychison
2011-02-23 19:43 ` Tony Luck
[not found] ` <AANLkTinjhY3oiFTq2xq4fwQ-mtLZ8ph435+nc5irM7wZ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-23 20:28 ` Mike Waychison
[not found] ` <AANLkTi=+-Wc0bWdpvR+X6UszLf7MXKYgi8Oo6anN-jR8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-23 21:29 ` Tony Luck [this message]
[not found] ` <AANLkTi=dE5_VjJ+5H6cWf9nAtdkLiqhSXo6Gvd_uGQ25-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-02-25 19:58 ` Greg KH
2011-02-23 1:53 ` [PATCH v2 4/5] firmware: Expose DMI type 15 System Event Log Mike Waychison
2011-02-23 1:53 ` [PATCH v2 5/5] firmware: Add documentation for /sys/firmware/dmi Mike Waychison
[not found] ` <20110223015307.13068.14063.stgit-tzAwxxnF6Tt6FDdRrpk8kO4/NqBCd+6Q@public.gmane.org>
2011-02-23 1:53 ` [PATCH v2 3/5] firmware: Break out system_event_log in dmi-sysfs Mike Waychison
2011-02-25 20:03 ` [PATCH v2 0/5] Exporting DMI entries via sysfs Greg KH
2011-02-25 23:06 ` [PATCH v2 6/5] Fix unaligned memory accesses in dmi-sysfs Mike Waychison
[not found] ` <4D6835F1.2050304-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2011-02-25 23:20 ` Greg KH
2011-02-25 23:41 ` [resend PATCH " Mike Waychison
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='AANLkTi=dE5_VjJ+5H6cWf9nAtdkLiqhSXo6Gvd_uGQ25@mail.gmail.com' \
--to=tony.luck-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=adurbin-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=alan-qBU/x9rampVanCEyBjwyrvXRex20P6io@public.gmane.org \
--cc=andi-Vw/NltI1exuRpAAqCnN02g@public.gmane.org \
--cc=dhendrix-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=dlaurie-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org \
--cc=jonmayer-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mikew-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=olofj-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
--cc=rlippert-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=thockin-hpIqsD4AKlfQT0dZR+AlfA@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).