diff options
author | Evgeniy Naydanov <evgeniy.naydanov@syntacore.com> | 2025-02-14 19:20:58 +0300 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2025-03-15 10:19:45 +0000 |
commit | e12ceddd5ee4d946107e3764d05ce2810befb293 (patch) | |
tree | 6bf284c57feffa622848d3a3da8f07d404cc1b91 /src/rtos/rtos_nuttx_stackings.c | |
parent | a2d4b9b718552a4bbb88e0f210444b4f5047bc0c (diff) | |
download | riscv-openocd-e12ceddd5ee4d946107e3764d05ce2810befb293.zip riscv-openocd-e12ceddd5ee4d946107e3764d05ce2810befb293.tar.gz riscv-openocd-e12ceddd5ee4d946107e3764d05ce2810befb293.tar.bz2 |
helper/log: mark `fmt` argument of `alloc_vprintf()` as format string
Building on Ubuntu 22.04 with `-fsanitize=undefined` (GCC 12.3.0)
results in an error:
Checkpatch-ignore: COMMIT_LOG_LONG_LINE
```
In file included from /usr/include/stdio.h:894,
from <openocd>/src/helper/system.h:23,
from <openocd>/src/helper/replacements.h:18,
from <openocd>/src/helper/log.c:20:
In function ‘vsnprintf’,
inlined from ‘alloc_vprintf’ at <openocd>/src/helper/log.c:347:8:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:85:10: error: null format string [-Werror=format-truncation=]
85 | return __builtin___vsnprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
86 | __glibc_objsize (__s), __fmt, __ap);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
```
The error mentiones the call site `src/helper/log.c:347`. There
`vsnprintf()` is called passing `fmt` as format string.
To mitigate this, mark the format string with the corresponding
attribute in `alloc_vprintf()`
Change-Id: I91011490715998ef5a931c19c3c9d74a1a304e5d
Signed-off-by: Evgeniy Naydanov <evgeniy.naydanov@syntacore.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/8764
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
Diffstat (limited to 'src/rtos/rtos_nuttx_stackings.c')
0 files changed, 0 insertions, 0 deletions