[PATCH 1/7] perf trace: Defensive programming
From: Ian Munsie
Date: Thu May 13 2010 - 02:04:50 EST
From: Ian Munsie <imunsie@xxxxxxxxxxx>
This patch makes the failure case where the size that read_size is
passed is invalid kill perf immediately rather than silently failing, so
that further bugs or regressions using read_size can be found more
easily and squashed early.
Signed-off-by: Ian Munsie <imunsie@xxxxxxxxxxx>
---
tools/perf/util/trace-event-parse.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index 73a0222..8f470f6 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -1912,8 +1912,7 @@ unsigned long long read_size(void *ptr, int size)
case 8:
return data2host8(ptr);
default:
- /* BUG! */
- return 0;
+ die("read_size BUG: Invalid size %d", size);
}
}
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/