2024-04-18 12:34:51

by Naresh Kamboju

[permalink] [raw]
Subject: selftests: arm64: check_buffer_fill.c:94:93: warning: format '%lx' expects argument of type 'long unsigned int', but argument 3 has type 'char *' [-Wformat=]

The Linux next building selftests with clang and gcc-13 found these
build warnings.

Reported-by: Linux Kernel Functional Testing <[email protected]>

Build log:
---------
PATH:
Reported build warnings noticed on following test files,
selftests/arm64/mte/
* check_buffer_fill.c
* mte_common_util.c

check_buffer_fill.c: In function 'check_buffer_underflow_by_byte':
check_buffer_fill.c:94:93: warning: format '%lx' expects argument of
type 'long unsigned int', but argument 3 has type 'char *' [-Wformat=]
94 | ksft_print_msg("Buffer is not
filled at index:%d of ptr:0x%lx\n",
|
~~^
|
|
|
long unsigned int
|
%s
95 | j, ptr);
| ~~~
| |
| char *

<trim>

mte_common_util.c: In function 'mte_default_handler':
mte_common_util.c:41:101: warning: format '%lx' expects argument of
type 'long unsigned int', but argument 2 has type 'long long unsigned
int' [-Wformat=]
41 | ksft_print_msg("Got unexpected
SEGV_MTEAERR at pc=$lx, fault addr=%lx\n",
|
~~^
|
|
|
long unsigned int
|
%llx
42 | ((ucontext_t
*)uc)->uc_mcontext.pc,
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
long long unsigned int
mte_common_util.c:41:48: warning: too many arguments for format
[-Wformat-extra-args]
41 | ksft_print_msg("Got unexpected
SEGV_MTEAERR at pc=$lx, fault addr=%lx\n",
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Steps to reproduce:
---
tuxmake --runtime podman --target-arch arm64 --toolchain clang-nightly \
--kconfig https://storage.tuxsuite.com/public/linaro/lkft/builds/2fDW3nAXzFH2GOEle3S3MVC53A9/config
\
LLVM=1 LLVM_IAS=1 debugkernel dtbs dtbs-legacy headers kernel
kselftest modules


tuxmake --runtime podman --target-arch arm64 --toolchain gcc-13 \
--kconfig https://storage.tuxsuite.com/public/linaro/lkft/builds/2fDW3wG8BqWxf0afUI5f4wkArPi/config
\
debugkernel dtbs dtbs-legacy headers kernel kselftest modules


Links:
- https://storage.tuxsuite.com/public/linaro/lkft/builds/2fDW3nAXzFH2GOEle3S3MVC53A9/
- https://storage.tuxsuite.com/public/linaro/lkft/builds/2fDW3wG8BqWxf0afUI5f4wkArPi/

--
Linaro LKFT
https://lkft.linaro.org