diff options
| author | jvoisin | 2024-07-10 15:49:00 +0200 |
|---|---|---|
| committer | jvoisin | 2024-07-10 15:49:00 +0200 |
| commit | 6f5423255b6d78b0d6979e6319642ae530f3e2b7 (patch) | |
| tree | 96c9370b3b42477f194052707d0010b1f83839b3 /include | |
| parent | 459d202b1bbf7abb817a596ce9374edfb7b4da8f (diff) | |
Fix `access` annotations for vsnprintf/vsprintf
This fix the following issue:
```
In file included from exec-cmd.c:9:
In function 'vsnprintf',
inlined from 'report.constprop' at subcmd-util.h:13:2:
/usr/include/fortify/stdio.h:162:16: error: 'msg' may be used uninitialized [-Werror=maybe-uninitialized]
162 | return __orig_vsnprintf(__s, __n, __f, __v);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/fortify/strings.h:23,
from /usr/include/string.h:59,
from /usr/include/fortify/string.h:23,
from /home/ncopa/aports/main/linux-lts/src/linux-6.6/tools/include/linux/string.h:6,
from exec-cmd.c:3:
/usr/include/fortify/stdio.h: In function 'report.constprop':
/usr/include/fortify/stdio.h:152:1: note: in a call to '__orig_vsnprintf' declared with attribute 'access (read_write, 1, 2)' here
152 | _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n,
| ^~~~~~~~~~~
In file included from exec-cmd.c:10:
subcmd-util.h:12:14: note: 'msg' declared here
12 | char msg[1024];
| ^~~
cc1: all warnings being treated as errors
make[5]: *** [/home/ncopa/aports/main/linux-lts/src/linux-6.6/tools/build/Makefile.build:98: /home/ncopa/aports/main/linux-lts/src/build-virt.x86_64/tools/objtool/libsubcmd/exec-cmd.o] Error 1
make[4]: *** [Makefile:80: /home/ncopa/aports/main/linux-lts/src/build-virt.x86_64/tools/objtool/libsubcmd/libsubcmd-in.o] Error 2
make[3]: *** [Makefile:78: /home/ncopa/aports/main/linux-lts/src/build-virt.x86_64/tools/objtool/libsubcmd/libsubcmd.a] Error 2
make[2]: *** [Makefile:73: objtool] Error 2
make[1]: *** [/home/ncopa/aports/main/linux-lts/src/linux-6.6/Makefile:1362: tools/objtool] Error 2
make: *** [/home/ncopa/aports/main/linux-lts/src/linux-6.6/Makefile:234: __sub-make] Error 2
```
Reported-by: ncopa
Diffstat (limited to 'include')
| -rw-r--r-- | include/stdio.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/stdio.h b/include/stdio.h index d04771d..fcd0ac9 100644 --- a/include/stdio.h +++ b/include/stdio.h | |||
| @@ -143,7 +143,7 @@ _FORTIFY_FN(tmpfile) FILE *tmpfile(void) | |||
| 143 | } | 143 | } |
| 144 | #endif | 144 | #endif |
| 145 | 145 | ||
| 146 | __fh_access(read_write, 1, 2) | 146 | __fh_access(write_only, 1, 2) |
| 147 | __fh_access(read_only, 3) | 147 | __fh_access(read_only, 3) |
| 148 | __fh_format(printf, 3, 0) | 148 | __fh_format(printf, 3, 0) |
| 149 | #if __has_builtin(__builtin_vsnprintf) | 149 | #if __has_builtin(__builtin_vsnprintf) |
| @@ -164,7 +164,7 @@ _FORTIFY_FN(vsnprintf) int vsnprintf(char * _FORTIFY_POS0 __s, size_t __n, | |||
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | __fh_format(printf, 2, 0) | 166 | __fh_format(printf, 2, 0) |
| 167 | __fh_access(read_write, 1) | 167 | __fh_access(write_only, 1) |
| 168 | __fh_access(read_only, 2) | 168 | __fh_access(read_only, 2) |
| 169 | #if __has_builtin(__builtin_vsprintf) | 169 | #if __has_builtin(__builtin_vsprintf) |
| 170 | __diagnose_as_builtin(__builtin_vsprintf, 1, 2, 3) | 170 | __diagnose_as_builtin(__builtin_vsprintf, 1, 2, 3) |
