Date: Wed, 20 Sep 2006 07:41:18 -0400 From: Prarit Bhargava <prarit@redhat.com> Subject: Re: [RHEL5 PATCH]: BZ 198572 Module load unaligned access errors David Howells wrote: >This should really use get_unaligned() not memcpy() - after all, some archs >can handle it directly without the need to throw an exception. > Good point -- thanks David. New patch ... P. Patch to fix unaligned access during module loads. Tested by Doug (dchapman@redhat.com) on HP ia64 boxes, and by me on SGI ia64 box. Additionally tested by me on x86_64. Addresses and resolves BZ 198572. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Signed-off-by: Doug Chapman <dchapman@redhat.com> --- linux-2.6.17.ia64/lib/sha1.c.orig 2006-09-19 17:07:59.000000000 -0400 +++ linux-2.6.17.ia64/lib/sha1.c 2006-09-19 17:07:48.000000000 -0400 @@ -3,6 +3,7 @@ * Peter Gutmann, and placed in the public domain. */ +#include <asm/unaligned.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/cryptohash.h> @@ -41,7 +42,7 @@ __u32 a, b, c, d, e, t, i; for (i = 0; i < 16; i++) - W[i] = be32_to_cpu(((const __be32 *)in)[i]); + W[i] = be32_to_cpu(get_unaligned((const __be32 *)in+i)); for (i = 0; i < 64; i++) W[i+16] = rol32(W[i+13] ^ W[i+8] ^ W[i+2] ^ W[i], 1);