lkml.org 
[lkml]   [2010]   [May]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/7] perf trace: Defensive programming
Date
From: Ian Munsie <imunsie@au1.ibm.com>

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@au1.ibm.com>
---
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


\
 
 \ /
  Last update: 2010-05-13 08:07    [from the cache]
©2003-2011 Jasper Spaans