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