[PATCH] connector: some fixes for ia64 unaligned access errors

On ia64, the various functions that make up cn_proc.c cause kernel
unaligned access errors.

If you are using these, for example, to get notification about all tasks
forking and exiting, you get multiple unaligned access errors per process.

Use put_unaligned() in the appropriate palces to fix this.

Signed-off-by: Erik Jacobson <erikj@sgi.com>
Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Cc: "Luck, Tony" <tony.luck@intel.com>
Cc: <stable@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by Erik Jacobson and committed by Linus Torvalds af3e095a 76395d37

+6 -5
+6 -5
drivers/connector/cn_proc.c
··· 28 28 #include <linux/init.h> 29 29 #include <linux/connector.h> 30 30 #include <asm/atomic.h> 31 + #include <asm/unaligned.h> 31 32 32 33 #include <linux/cn_proc.h> 33 34 ··· 61 60 ev = (struct proc_event*)msg->data; 62 61 get_seq(&msg->seq, &ev->cpu); 63 62 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 64 - ev->timestamp_ns = timespec_to_ns(&ts); 63 + put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); 65 64 ev->what = PROC_EVENT_FORK; 66 65 ev->event_data.fork.parent_pid = task->real_parent->pid; 67 66 ev->event_data.fork.parent_tgid = task->real_parent->tgid; ··· 89 88 ev = (struct proc_event*)msg->data; 90 89 get_seq(&msg->seq, &ev->cpu); 91 90 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 92 - ev->timestamp_ns = timespec_to_ns(&ts); 91 + put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); 93 92 ev->what = PROC_EVENT_EXEC; 94 93 ev->event_data.exec.process_pid = task->pid; 95 94 ev->event_data.exec.process_tgid = task->tgid; ··· 125 124 return; 126 125 get_seq(&msg->seq, &ev->cpu); 127 126 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 128 - ev->timestamp_ns = timespec_to_ns(&ts); 127 + put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); 129 128 130 129 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); 131 130 msg->ack = 0; /* not used */ ··· 147 146 ev = (struct proc_event*)msg->data; 148 147 get_seq(&msg->seq, &ev->cpu); 149 148 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 150 - ev->timestamp_ns = timespec_to_ns(&ts); 149 + put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); 151 150 ev->what = PROC_EVENT_EXIT; 152 151 ev->event_data.exit.process_pid = task->pid; 153 152 ev->event_data.exit.process_tgid = task->tgid; ··· 182 181 ev = (struct proc_event*)msg->data; 183 182 msg->seq = rcvd_seq; 184 183 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 185 - ev->timestamp_ns = timespec_to_ns(&ts); 184 + put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns); 186 185 ev->cpu = -1; 187 186 ev->what = PROC_EVENT_NONE; 188 187 ev->event_data.ack.err = err;