|
|
5db3bf |
From 6a3dd40539c1804db8b1fe1684afa5fa111636fe Mon Sep 17 00:00:00 2001
|
|
|
5db3bf |
From: John Kacur <jkacur@redhat.com>
|
|
|
5db3bf |
Date: Thu, 11 Nov 2021 08:56:54 -0500
|
|
|
5db3bf |
Subject: [PATCH] rt-tests: deadline_tests: Null check to prevent floating
|
|
|
5db3bf |
point exception
|
|
|
5db3bf |
|
|
|
5db3bf |
Fix a floating point exception that can occur if sd->nr_adjust is 0
|
|
|
5db3bf |
by checking it before performing a division by zero.
|
|
|
5db3bf |
|
|
|
5db3bf |
Signed-off-by: John Kacur <jkacur@redhat.com>
|
|
|
5db3bf |
---
|
|
|
5db3bf |
src/sched_deadline/deadline_test.c | 6 ++++--
|
|
|
5db3bf |
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
|
5db3bf |
|
|
|
5db3bf |
diff --git a/src/sched_deadline/deadline_test.c b/src/sched_deadline/deadline_test.c
|
|
|
5db3bf |
index 53abd4d2ca6b..b7e1e045b57c 100644
|
|
|
5db3bf |
--- a/src/sched_deadline/deadline_test.c
|
|
|
5db3bf |
+++ b/src/sched_deadline/deadline_test.c
|
|
|
5db3bf |
@@ -2050,8 +2050,10 @@ int main(int argc, char **argv)
|
|
|
5db3bf |
printf("missed deadlines = %d\n", sd->missed_deadlines);
|
|
|
5db3bf |
printf("missed periods = %d\n", sd->missed_periods);
|
|
|
5db3bf |
printf("Total adjustments = %lld us\n", sd->total_adjust);
|
|
|
5db3bf |
- printf("# adjustments = %lld avg: %lld us\n",
|
|
|
5db3bf |
- sd->nr_adjust, sd->total_adjust / sd->nr_adjust);
|
|
|
5db3bf |
+ if (sd->nr_adjust) {
|
|
|
5db3bf |
+ printf("# adjustments = %lld avg: %lld us\n",
|
|
|
5db3bf |
+ sd->nr_adjust, sd->total_adjust / sd->nr_adjust);
|
|
|
5db3bf |
+ }
|
|
|
5db3bf |
printf("deadline : %lld us\n", sd->deadline_us);
|
|
|
5db3bf |
printf("runtime : %lld us\n", sd->runtime_us);
|
|
|
5db3bf |
printf("nr_periods : %lld\n", sd->nr_periods);
|
|
|
5db3bf |
--
|
|
|
5db3bf |
2.31.1
|
|
|
5db3bf |
|