selftests: mm: seal_elf.c:140:45: warning: format '%s' expects argument of type 'char *', but argument 5 has type 'char (*)[5]' [-Wformat=]

From: Naresh Kamboju
Date: Thu Apr 18 2024 - 05:37:46 EST


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

Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>

Build log:
---------
PATH:
selftests/mm/seal_elf

seal_elf.c: In function 'test_seal_elf':
seal_elf.c:140:45: warning: format '%s' expects argument of type 'char
*', but argument 5 has type 'char (*)[5]' [-Wformat=]
140 | if (sscanf(line, "%lx-%lx %4s %*x %*x:%*x %*u
%255[^\n]",
| ~~^
| |
| char *
141 | &addr_start, &addr_end, &prot,
&filename) == 4) {
| ~~~~~
| |
| char (*)[5]
seal_elf.c:140:69: warning: format '%[^
' expects argument of type 'char *', but argument 6 has type 'char
(*)[256]' [-Wformat=]
140 | if (sscanf(line, "%lx-%lx %4s %*x %*x:%*x %*u
%255[^\n]",
| ~~~~~~^~
| |
|
char *
141 | &addr_start, &addr_end, &prot,
&filename) == 4) {
| ~~~~~~~~~
| |
| char (*)[256]
seal_elf.c:110:13: warning: unused variable 'size' [-Wunused-variable]
110 | int size = 0;
| ^~~~
/usr/lib/gcc-cross/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/bin/ld:
/tmp/cczODkiZ.o: in function `test_seal_elf':
seal_elf.c:(.text+0x738): undefined reference to `sys_mprotect'
/usr/lib/gcc-cross/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/bin/ld:
seal_elf.c:(.text+0x794): undefined reference to `sys_mprotect'
/usr/lib/gcc-cross/aarch64-linux-gnu/13/../../../../aarch64-linux-gnu/bin/ld:
seal_elf.c:(.text+0x944): undefined reference to `sys_mprotect'
collect2: error: ld returned 1 exit status

Steps to reproduce:
---
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/2fDW3wG8BqWxf0afUI5f4wkArPi/

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