diff mbox series

rt-tests: cyclictest: Fix seg fault for verbose with no affinity maxk

Message ID 20220629153140.15073-1-jkacur@redhat.com
State New
Headers show
Series rt-tests: cyclictest: Fix seg fault for verbose with no affinity maxk | expand

Commit Message

John Kacur June 29, 2022, 3:31 p.m. UTC
Using verbose with affinity and no affinity mask causes a
segmentation mask. Fix this by checking if the affinity mask is NULL
before printing the verbose message.

Reported-by: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
 src/cyclictest/cyclictest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index d90228a7ebec..decea786268a 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1088,7 +1088,7 @@  static void process_options(int argc, char *argv[], int max_cpus)
 
 			if (setaffinity == AFFINITY_SPECIFIED && !affinity_mask)
 				display_help(1);
-			if (verbose)
+			if (verbose && affinity_mask)
 				printf("Using %u cpus.\n",
 					numa_bitmask_weight(affinity_mask));
 			break;