Skip to contentSkip to conversation

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

PATCH New John Kacur 1 participant 1 message Jun 29, 2022

lore
Share & tools
lore

John Kacur

author
#0 lore raw

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

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.

---
 src/cyclictest/cyclictest.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/cyclictest/cyclictest.c +1 -1
index d90228a7ebec..decea786268a 100644
@@ -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;
Signature · 1 line
2.36.1