mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] NSM: Fix unaligned accesses in nsm_init_private()
@ 2009-03-28 19:55 Mans Rullgard
  2009-03-30 19:40 ` Chuck Lever
  0 siblings, 1 reply; 2+ messages in thread
From: Mans Rullgard @ 2009-03-28 19:55 UTC (permalink / raw)
  To: linux-kernel, linux-nfs

This fixes unaligned accesses in nsm_init_private() when
creating nlm_reboot keys.

Signed-off-by: Mans Rullgard <mans@mansr.com>
---
 fs/lockd/mon.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
index 5e2c4d5..6d5d4a4 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
@@ -16,6 +16,8 @@
 #include <linux/sunrpc/svc.h>
 #include <linux/lockd/lockd.h>
 
+#include <asm/unaligned.h>
+
 #define NLMDBG_FACILITY		NLMDBG_MONITOR
 #define NSM_PROGRAM		100024
 #define NSM_VERSION		1
@@ -274,10 +276,12 @@ static void nsm_init_private(struct nsm_handle *nsm)
 {
 	u64 *p = (u64 *)&nsm->sm_priv.data;
 	struct timespec ts;
+	s64 ns;
 
 	ktime_get_ts(&ts);
-	*p++ = timespec_to_ns(&ts);
-	*p = (unsigned long)nsm;
+	ns = timespec_to_ns(&ts);
+	put_unaligned(ns, p);
+	put_unaligned((unsigned long)nsm, p + 1);
 }
 
 static struct nsm_handle *nsm_create_handle(const struct sockaddr *sap,
-- 
1.6.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-30 19:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-28 19:55 [PATCH] NSM: Fix unaligned accesses in nsm_init_private() Mans Rullgard
2009-03-30 19:40 ` Chuck Lever

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®