Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 4bf15b1

Browse files
johnhubbardshuahkh
authored andcommitted
selftests/futex: don't pass a const char* to asprintf(3)
When building with clang, via: make LLVM=1 -C tools/testing/selftests ...clang issues this warning: futex_requeue_pi.c:403:17: warning: passing 'const char **' to parameter of type 'char **' discards qualifiers in nested pointer types [-Wincompatible-pointer-types-discards-qualifiers] This warning fires because test_name is passed into asprintf(3), which then changes it. Fix this by simply removing the const qualifier. This is a local automatic variable in a very short function, so there is not much need to use the compiler to enforce const-ness at this scope. [1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1c49f@valentinobst.de/ Fixes: f17d8a8 ("selftests: fuxex: Report a unique test name per run of futex_requeue_pi") Reviewed-by: Davidlohr Bueso <dave@stgolabs.net> Signed-off-by: John Hubbard <jhubbard@nvidia.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 32c75ad commit 4bf15b1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ int unit_test(int broadcast, long lock, int third_party_owner, long timeout_ns)
360360

361361
int main(int argc, char *argv[])
362362
{
363-
const char *test_name;
363+
char *test_name;
364364
int c, ret;
365365

366366
while ((c = getopt(argc, argv, "bchlot:v:")) != -1) {

0 commit comments

Comments
 (0)