diff options
author | Carsten Emde <Carsten.Emde@osadl.org> | 2009-12-06 08:02:44 -0500 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2009-12-09 14:20:08 -0500 |
commit | f2942487ffb0c0a80b2312f667ea30dd55a24bb0 (patch) | |
tree | 8e6e4c8ae8230f2648142c863e8482b7656e6614 /kernel | |
parent | be1eca39319689aed7d3aedb9c3bece9469fe10f (diff) |
tracing: Remove comparing of NULL to va_list in trace_array_vprintk()
Olof Johansson stated the following:
Comparing a va_list with NULL is bogus. It's supposed to be treated like
an opaque type and only be manipulated with va_* accessors.
Olof noticed that this code broke the ARM builds:
kernel/trace/trace.c: In function 'trace_array_vprintk':
kernel/trace/trace.c:1364: error: invalid operands to binary == (have 'va_list' and 'void *')
kernel/trace/trace.c: In function 'tracing_mark_write':
kernel/trace/trace.c:3349: error: incompatible type for argument 3 of 'trace_vprintk'
This patch partly reverts c13d2f7c3231e873f30db92b96c8caa48f100f33 and
re-installs the original mark_printk() mechanism.
Reported-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Carsten Emde <C.Emde@osadl.org>
LKML-Reference: <4B1BAB74.104@osadl.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 484114d70743..88bd9ae2a9ed 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -1361,11 +1361,7 @@ int trace_array_vprintk(struct trace_array *tr, | |||
1361 | pause_graph_tracing(); | 1361 | pause_graph_tracing(); |
1362 | raw_local_irq_save(irq_flags); | 1362 | raw_local_irq_save(irq_flags); |
1363 | __raw_spin_lock(&trace_buf_lock); | 1363 | __raw_spin_lock(&trace_buf_lock); |
1364 | if (args == NULL) { | 1364 | len = vsnprintf(trace_buf, TRACE_BUF_SIZE, fmt, args); |
1365 | strncpy(trace_buf, fmt, TRACE_BUF_SIZE); | ||
1366 | len = strlen(trace_buf); | ||
1367 | } else | ||
1368 | len = vsnprintf(trace_buf, TRACE_BUF_SIZE, fmt, args); | ||
1369 | 1365 | ||
1370 | size = sizeof(*entry) + len + 1; | 1366 | size = sizeof(*entry) + len + 1; |
1371 | buffer = tr->buffer; | 1367 | buffer = tr->buffer; |
@@ -3353,6 +3349,16 @@ tracing_entries_write(struct file *filp, const char __user *ubuf, | |||
3353 | return cnt; | 3349 | return cnt; |
3354 | } | 3350 | } |
3355 | 3351 | ||
3352 | static int mark_printk(const char *fmt, ...) | ||
3353 | { | ||
3354 | int ret; | ||
3355 | va_list args; | ||
3356 | va_start(args, fmt); | ||
3357 | ret = trace_vprintk(0, fmt, args); | ||
3358 | va_end(args); | ||
3359 | return ret; | ||
3360 | } | ||
3361 | |||
3356 | static ssize_t | 3362 | static ssize_t |
3357 | tracing_mark_write(struct file *filp, const char __user *ubuf, | 3363 | tracing_mark_write(struct file *filp, const char __user *ubuf, |
3358 | size_t cnt, loff_t *fpos) | 3364 | size_t cnt, loff_t *fpos) |
@@ -3379,7 +3385,7 @@ tracing_mark_write(struct file *filp, const char __user *ubuf, | |||
3379 | } else | 3385 | } else |
3380 | buf[cnt] = '\0'; | 3386 | buf[cnt] = '\0'; |
3381 | 3387 | ||
3382 | cnt = trace_vprintk(0, buf, NULL); | 3388 | cnt = mark_printk("%s", buf); |
3383 | kfree(buf); | 3389 | kfree(buf); |
3384 | *fpos += cnt; | 3390 | *fpos += cnt; |
3385 | 3391 | ||