aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTuukka Tikkanen <tuukka.tikkanen@linaro.org>2014-12-03 12:05:13 +0200
committerTuukka Tikkanen <tuukka.tikkanen@linaro.org>2014-12-05 09:52:39 +0200
commit4fea09fd20ec00a57bca4e686b30c17f506c2312 (patch)
tree19f4816c9f3e96253d24049180c73d0bb73f8f83
parent3f4fdcf1c20e4efd7b17ca1dba8e5965e2fe3f66 (diff)
idlestat: Add parameter assertions to intersection()
The function intersection() uses pointer parameters without checking the validity. Add assert() statements making sure the pointers are not NULL. Signed-off-by: Tuukka Tikkanen <tuukka.tikkanen@linaro.org> Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>
-rw-r--r--idlestat.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/idlestat.c b/idlestat.c
index 5d9f12e..7e3ea38 100644
--- a/idlestat.c
+++ b/idlestat.c
@@ -205,6 +205,9 @@ static struct cpuidle_data *intersection(struct cpuidle_data *data1,
double begin, end;
struct cpuidle_data *data;
+ assert(data1 != NULL);
+ assert(data2 != NULL);
+
begin = MAX(data1->begin, data2->begin);
end = MIN(data1->end, data2->end);