[PATCH] markers: fix unchecked format

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Lai Jiangshan
Date: Tuesday, October 7, 2008 - 7:23 pm

when the second, third... probe is registered, its format is
not checked, this patch fix it.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
---
diff --git a/kernel/marker.c b/kernel/marker.c
index 4440a09..1196a6b 100644
--- a/kernel/marker.c
+++ b/kernel/marker.c
@@ -651,11 +651,17 @@ int marker_probe_register(const char *name, const char *format,
 	entry = get_marker(name);
 	if (!entry) {
 		entry = add_marker(name, format);
-		if (IS_ERR(entry)) {
+		if (IS_ERR(entry))
 			ret = PTR_ERR(entry);
-			goto end;
-		}
+	} else if (format) {
+		if (!entry->format)
+			ret = marker_set_format(&entry, format);
+		else if (strcmp(entry->format, format))
+			ret = -EPERM;
 	}
+	if (ret)
+		goto end;
+
 	/*
 	 * If we detect that a call_rcu is pending for this marker,
 	 * make sure it's executed now.


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] markers: fix unchecked format, Lai Jiangshan, (Tue Oct 7, 7:23 pm)
Re: [PATCH] markers: fix unchecked format, Mathieu Desnoyers, (Tue Oct 7, 9:05 pm)
Re: [PATCH] markers: fix unchecked format, Lai Jiangshan, (Tue Oct 7, 10:04 pm)
Re: [PATCH] markers: fix unchecked format, Mathieu Desnoyers, (Thu Oct 9, 6:46 am)
Re: [PATCH] markers: fix unchecked format, Ingo Molnar, (Thu Oct 9, 7:05 am)