Skip to content

Commit 1a9dcf6

Browse files
Sebastian Andrzej SiewiorPeter Zijlstra
authored andcommitted
selftests/futex: getopt() requires int as return value.
Mark reported that futex_priv_hash fails on ARM64. It turns out that the command line parsing does not terminate properly and ends in the default case assuming an invalid option was passed. Use an int as the return type for getopt(). Closes: https://lore.kernel.org/all/[email protected]/ Fixes: 3163369 ("selftests/futex: Add futex_numa_mpol") Fixes: cda95fa ("selftests/futex: Add futex_priv_hash") Reported-by: Mark Brown <[email protected]> Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent ec7714e commit 1a9dcf6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tools/testing/selftests/futex/functional/futex_numa_mpol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ int main(int argc, char *argv[])
144144
struct futex32_numa *futex_numa;
145145
int mem_size, i;
146146
void *futex_ptr;
147-
char c;
147+
int c;
148148

149149
while ((c = getopt(argc, argv, "chv:")) != -1) {
150150
switch (c) {

tools/testing/selftests/futex/functional/futex_priv_hash.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ int main(int argc, char *argv[])
130130
pthread_mutexattr_t mutex_attr_pi;
131131
int use_global_hash = 0;
132132
int ret;
133-
char c;
133+
int c;
134134

135135
while ((c = getopt(argc, argv, "cghv:")) != -1) {
136136
switch (c) {

0 commit comments

Comments
 (0)