From 4fea09fd20ec00a57bca4e686b30c17f506c2312 Mon Sep 17 00:00:00 2001 From: Tuukka Tikkanen Date: Wed, 3 Dec 2014 12:05:13 +0200 Subject: 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 Reviewed-by: Amit Kucheria --- idlestat.c | 3 +++ 1 file changed, 3 insertions(+) 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); -- cgit v1.2.3