aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/connector
diff options
context:
space:
mode:
authorErik Jacobson <erikj@sgi.com>2007-01-05 19:37:05 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2007-01-06 02:55:29 -0500
commitaf3e095a1fb42bac32355d5d59ce93f8b4e59a3e (patch)
treefaaf69ff1911e126bd243821d54db42c1da9e61b /drivers/connector
parent76395d37611e8758dd8bd6c6f5bfcb31e1dc48f9 (diff)
[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>
Diffstat (limited to 'drivers/connector')
-rw-r--r--drivers/connector/cn_proc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c
index 3ece69231343..5c9f67f98d10 100644
--- a/drivers/connector/cn_proc.c
+++ b/drivers/connector/cn_proc.c
@@ -28,6 +28,7 @@
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/connector.h> 29#include <linux/connector.h>
30#include <asm/atomic.h> 30#include <asm/atomic.h>
31#include <asm/unaligned.h>
31 32
32#include <linux/cn_proc.h> 33#include <linux/cn_proc.h>
33 34
@@ -60,7 +61,7 @@ void proc_fork_connector(struct task_struct *task)
60 ev = (struct proc_event*)msg->data; 61 ev = (struct proc_event*)msg->data;
61 get_seq(&msg->seq, &ev->cpu); 62 get_seq(&msg->seq, &ev->cpu);
62 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 63 ktime_get_ts(&ts); /* get high res monotonic timestamp */
63 ev->timestamp_ns = timespec_to_ns(&ts); 64 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
64 ev->what = PROC_EVENT_FORK; 65 ev->what = PROC_EVENT_FORK;
65 ev->event_data.fork.parent_pid = task->real_parent->pid; 66 ev->event_data.fork.parent_pid = task->real_parent->pid;
66 ev->event_data.fork.parent_tgid = task->real_parent->tgid; 67 ev->event_data.fork.parent_tgid = task->real_parent->tgid;
@@ -88,7 +89,7 @@ void proc_exec_connector(struct task_struct *task)
88 ev = (struct proc_event*)msg->data; 89 ev = (struct proc_event*)msg->data;
89 get_seq(&msg->seq, &ev->cpu); 90 get_seq(&msg->seq, &ev->cpu);
90 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 91 ktime_get_ts(&ts); /* get high res monotonic timestamp */
91 ev->timestamp_ns = timespec_to_ns(&ts); 92 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
92 ev->what = PROC_EVENT_EXEC; 93 ev->what = PROC_EVENT_EXEC;
93 ev->event_data.exec.process_pid = task->pid; 94 ev->event_data.exec.process_pid = task->pid;
94 ev->event_data.exec.process_tgid = task->tgid; 95 ev->event_data.exec.process_tgid = task->tgid;
@@ -124,7 +125,7 @@ void proc_id_connector(struct task_struct *task, int which_id)
124 return; 125 return;
125 get_seq(&msg->seq, &ev->cpu); 126 get_seq(&msg->seq, &ev->cpu);
126 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 127 ktime_get_ts(&ts); /* get high res monotonic timestamp */
127 ev->timestamp_ns = timespec_to_ns(&ts); 128 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
128 129
129 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id)); 130 memcpy(&msg->id, &cn_proc_event_id, sizeof(msg->id));
130 msg->ack = 0; /* not used */ 131 msg->ack = 0; /* not used */
@@ -146,7 +147,7 @@ void proc_exit_connector(struct task_struct *task)
146 ev = (struct proc_event*)msg->data; 147 ev = (struct proc_event*)msg->data;
147 get_seq(&msg->seq, &ev->cpu); 148 get_seq(&msg->seq, &ev->cpu);
148 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 149 ktime_get_ts(&ts); /* get high res monotonic timestamp */
149 ev->timestamp_ns = timespec_to_ns(&ts); 150 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
150 ev->what = PROC_EVENT_EXIT; 151 ev->what = PROC_EVENT_EXIT;
151 ev->event_data.exit.process_pid = task->pid; 152 ev->event_data.exit.process_pid = task->pid;
152 ev->event_data.exit.process_tgid = task->tgid; 153 ev->event_data.exit.process_tgid = task->tgid;
@@ -181,7 +182,7 @@ static void cn_proc_ack(int err, int rcvd_seq, int rcvd_ack)
181 ev = (struct proc_event*)msg->data; 182 ev = (struct proc_event*)msg->data;
182 msg->seq = rcvd_seq; 183 msg->seq = rcvd_seq;
183 ktime_get_ts(&ts); /* get high res monotonic timestamp */ 184 ktime_get_ts(&ts); /* get high res monotonic timestamp */
184 ev->timestamp_ns = timespec_to_ns(&ts); 185 put_unaligned(timespec_to_ns(&ts), (__u64 *)&ev->timestamp_ns);
185 ev->cpu = -1; 186 ev->cpu = -1;
186 ev->what = PROC_EVENT_NONE; 187 ev->what = PROC_EVENT_NONE;
187 ev->event_data.ack.err = err; 188 ev->event_data.ack.err = err;