> On 14 Sep 2021, at 11:27 AM, sunyucong@xxxxxxxxx wrote: > >> +static int poke_kprobe_events(bool add, const char *name, bool retprobe, uint64_t offset) >> +{ >> + int fd, ret = 0; > > This patch introduced a warning/error in CI > > libbpf.c: In function ‘poke_kprobe_events’: > 648 libbpf.c:9063:37: error: ‘%s’ directive output may be truncated > writing up to 127 bytes into a region of size between 62 and 189 > [-Werror=format-truncation=] > 649 9063 | snprintf(cmd, sizeof(cmd), "%c:%s %s", > 650 | ^~ > 651 In file included from /usr/include/stdio.h:867, > 652 from libbpf.c:17: > 653 /usr/include/x86_64-linux-gnu/bits/stdio2.h:67:10: note: > ‘__builtin___snprintf_chk’ output between 4 and 258 bytes into a > destination of size 192 > 654 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, > 655 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 656 68 | __bos (__s), __fmt, __va_arg_pack ()); > 657 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ That happened because: + char cmd[192] = {}, probename[128] = {}, probefunc[128] = {}; was changed from original patch without initializing those to '\0' instead.