Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755785Ab1BWU3M (ORCPT ); Wed, 23 Feb 2011 15:29:12 -0500 Received: from smtp-out.google.com ([216.239.44.51]:50931 "EHLO smtp-out.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750947Ab1BWU3K (ORCPT ); Wed, 23 Feb 2011 15:29:10 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=google.com; s=beta; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=pS1oTvMyWL6cZloaWUcYtfOhNfP7YKDn9q3jygGHrCPTnFBOcTSxTIBH25SUzCUAeF vQHmsJKjZFstJ2SoP4Lw== MIME-Version: 1.0 In-Reply-To: References: <20110223015307.13068.14063.stgit@mike.mtv.corp.google.com> <20110223015320.13068.77428.stgit@mike.mtv.corp.google.com> From: Mike Waychison Date: Wed, 23 Feb 2011 12:28:46 -0800 Message-ID: Subject: Re: [PATCH v2 2/5] firmware: Basic dmi-sysfs support To: Tony Luck Cc: Greg KH , Olof Johansson , Andi Kleen , Alan Cox , Robert Lippert , Jon Mayer , Duncan Laurie , Aaron Durbin , linux-kernel@vger.kernel.org, Tim Hockin , David Hendrix , linux-api@vger.kernel.org Content-Type: multipart/mixed; boundary=000e0cd2bd1ccb90e6049cf8f2df X-System-Of-Record: true Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4991 Lines: 92 --000e0cd2bd1ccb90e6049cf8f2df Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Wed, Feb 23, 2011 at 11:43 AM, Tony Luck wrote: > On Tue, Feb 22, 2011 at 5:53 PM, Mike Waychison wrote: >> +static void __init dmi_sysfs_register_handle(const struct dmi_header *d= h, >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0void *_ret) >> +{ > > I'm seeing some unaligned references from this function > on ia64. =A0Code is loading a 2-byte value from an odd > address. We are dereferencing "dh", so looking at the > dmi_header definition, I'd have thought that we must > be touching dh->handle: > > struct dmi_header { > =A0 =A0 =A0 =A0u8 type; > =A0 =A0 =A0 =A0u8 length; > =A0 =A0 =A0 =A0u16 handle; > }; > > I don't see any code in this function that does this, > so I assume there is some inlining or macro stuff > happening. 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 =3D *dh; 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). --000e0cd2bd1ccb90e6049cf8f2df Content-Type: application/octet-stream; name=patch Content-Disposition: attachment; filename=patch Content-Transfer-Encoding: base64 X-Attachment-Id: f_gkip513f0 ZGlmZiAtLWdpdCBhL2RyaXZlcnMvZmlybXdhcmUvZG1pLXN5c2ZzLmMgYi9kcml2ZXJzL2Zpcm13 YXJlL2RtaS1zeXNmcy5jCmluZGV4IGE1YWZkODAuLmViMjZkNjIgMTAwNjQ0Ci0tLSBhL2RyaXZl cnMvZmlybXdhcmUvZG1pLXN5c2ZzLmMKKysrIGIvZHJpdmVycy9maXJtd2FyZS9kbWktc3lzZnMu YwpAQCAtMjYzLDIwICsyNjMsMTYgQEAgc3RydWN0IGRtaV9zeXN0ZW1fZXZlbnRfbG9nIHsKIAl1 OAlzdXBwb3J0ZWRfbG9nX3R5cGVfZGVzY3JpcHRvc1swXTsKIH0gX19wYWNrZWQ7CiAKLXN0YXRp YyBjb25zdCBzdHJ1Y3QgZG1pX3N5c3RlbV9ldmVudF9sb2cgKnRvX3NlbChjb25zdCBzdHJ1Y3Qg ZG1pX2hlYWRlciAqZGgpCi17Ci0JcmV0dXJuIChjb25zdCBzdHJ1Y3QgZG1pX3N5c3RlbV9ldmVu dF9sb2cgKilkaDsKLX0KLQogI2RlZmluZSBETUlfU1lTRlNfU0VMX0ZJRUxEKF9maWVsZCkg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xuIiwKLQkJCXNlbC0+YWNj ZXNzX21ldGhvZCk7CisJCQlzZWwuYWNjZXNzX21ldGhvZCk7CiAJCXJldHVybiAtRUlPOwogCX0K IH0KQEAgLTU5NSw3ICs1OTMsNyBAQCBzdGF0aWMgdm9pZCBfX2luaXQgZG1pX3N5c2ZzX3JlZ2lz dGVyX2hhbmRsZShjb25zdCBzdHJ1Y3QgZG1pX2hlYWRlciAqZGgsCiAJfQogCiAJLyogU2V0IHRo ZSBrZXkgKi8KLQllbnRyeS0+ZGggPSAqZGg7CisJbWVtY3B5KCZlbnRyeS0+ZGgsIGRoLCBzaXpl b2YoKmRoKSk7CiAJZW50cnktPmluc3RhbmNlID0gaW5zdGFuY2VfY291bnRzW2RoLT50eXBlXSsr OwogCWVudHJ5LT5wb3NpdGlvbiA9IHBvc2l0aW9uX2NvdW50Kys7CiAK --000e0cd2bd1ccb90e6049cf8f2df-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/