[DPDK/core Bug 1878] format-truncation warnings in eal_memalloc compiling find_numasocket and secondary_msl_create_walk

bugzilla at dpdk.org bugzilla at dpdk.org
Thu Feb 5 15:03:36 CET 2026


http://bugs.dpdk.org/show_bug.cgi?id=1878

            Bug ID: 1878
           Summary: format-truncation warnings in eal_memalloc compiling
                    find_numasocket and secondary_msl_create_walk
           Product: DPDK
           Version: 26.03
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: core
          Assignee: dev at dpdk.org
          Reporter: marat.khalili at huawei.com
                CC: stephen at networkplumber.org
  Target Milestone: ---

When configured with:
```bash
CC=gcc-13 meson setup --werror
'-Ddisable_drivers=gpu/*,net/bnx2x,net/cnxk,net/qede' -Denable_docs=false
-Dbuildtype=debug -Db_sanitize=address,undefined -Ddeveloper_mode=enabled
-Dc_args=-DRTE_ENABLE_ASSERT
```
the following warnings are produced during compilation of branch main
(de2604d55cb7098a941db696248c4d4d00abff43):
```
FAILED: lib/librte_eal.a.p/eal_linux_eal_memory.c.o 
gcc-13 -Ilib/librte_eal.a.p -Ilib -I../../src/lib -Ilib/eal/common
-I../../src/lib/eal/common -I. -I../../src -Iconfig -I../../src/config
-Ilib/eal/include -I../../src/lib/eal/include -Ilib/eal/linux/include
-I../../src/lib/eal/linux/include -Ilib/eal/x86/include
-I../../src/lib/eal/x86/include -I../../src/kernel/linux -Ilib/eal
-I../../src/lib/eal -Ilib/kvargs -I../../src/lib/kvargs -Ilib/log
-I../../src/lib/log -Ilib/metrics -I../../src/lib/metrics -Ilib/telemetry
-I../../src/lib/telemetry -Ilib/argparse -I../../src/lib/argparse
-fdiagnostics-color=always -fsanitize=address,undefined -fno-omit-frame-pointer
-D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -O0 -g
-include rte_config.h -Wvla -Wcast-qual -Wdeprecated -Wformat
-Wformat-nonliteral -Wformat-security -Wmissing-declarations
-Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith
-Wshadow -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings
-Wno-packed-not-aligned -Wno-missing-field-initializers -D_GNU_SOURCE
-DRTE_ENABLE_ASSERT -fPIC -march=native -mrtm -DALLOW_EXPERIMENTAL_API
-DALLOW_INTERNAL_API '-DABI_VERSION="26.1"'
-DRTE_EAL_PTHREAD_ATTR_SETAFFINITY_NP -DRTE_LOG_DEFAULT_LOGTYPE=lib.eal -MD -MQ
lib/librte_eal.a.p/eal_linux_eal_memory.c.o -MF
lib/librte_eal.a.p/eal_linux_eal_memory.c.o.d -o
lib/librte_eal.a.p/eal_linux_eal_memory.c.o -c
../../src/lib/eal/linux/eal_memory.c
../../src/lib/eal/linux/eal_memory.c: In function 'find_numasocket':
../../src/lib/eal/linux/eal_memory.c:450:31: error: 'snprintf' output may be
truncated before the last format character [-Werror=format-truncation=]
  450 |                         "%s/%s", hpi->hugedir,
eal_get_hugefile_prefix());
      |                               ^
../../src/lib/eal/linux/eal_memory.c:449:9: note: 'snprintf' output 2 or more
bytes (assuming 4097) into a destination of size 4096
  449 |         snprintf(hugedir_str, sizeof(hugedir_str),
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  450 |                         "%s/%s", hpi->hugedir,
eal_get_hugefile_prefix());
      |                        
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
and
```
FAILED: lib/librte_eal.a.p/eal_linux_eal_memalloc.c.o 
gcc-13 -Ilib/librte_eal.a.p -Ilib -I../../src/lib -Ilib/eal/common
-I../../src/lib/eal/common -I. -I../../src -Iconfig -I../../src/config
-Ilib/eal/include -I../../src/lib/eal/include -Ilib/eal/linux/include
-I../../src/lib/eal/linux/include -Ilib/eal/x86/include
-I../../src/lib/eal/x86/include -I../../src/kernel/linux -Ilib/eal
-I../../src/lib/eal -Ilib/kvargs -I../../src/lib/kvargs -Ilib/log
-I../../src/lib/log -Ilib/metrics -I../../src/lib/metrics -Ilib/telemetry
-I../../src/lib/telemetry -Ilib/argparse -I../../src/lib/argparse
-fdiagnostics-color=always -fsanitize=address,undefined -fno-omit-frame-pointer
-D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -O0 -g
-include rte_config.h -Wvla -Wcast-qual -Wdeprecated -Wformat
-Wformat-nonliteral -Wformat-security -Wmissing-declarations
-Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpointer-arith
-Wshadow -Wsign-compare -Wstrict-prototypes -Wundef -Wwrite-strings
-Wno-packed-not-aligned -Wno-missing-field-initializers -D_GNU_SOURCE
-DRTE_ENABLE_ASSERT -fPIC -march=native -mrtm -DALLOW_EXPERIMENTAL_API
-DALLOW_INTERNAL_API '-DABI_VERSION="26.1"'
-DRTE_EAL_PTHREAD_ATTR_SETAFFINITY_NP -DRTE_LOG_DEFAULT_LOGTYPE=lib.eal -MD -MQ
lib/librte_eal.a.p/eal_linux_eal_memalloc.c.o -MF
lib/librte_eal.a.p/eal_linux_eal_memalloc.c.o.d -o
lib/librte_eal.a.p/eal_linux_eal_memalloc.c.o -c
../../src/lib/eal/linux/eal_memalloc.c
../../src/lib/eal/linux/eal_memalloc.c: In function
'secondary_msl_create_walk':
../../src/lib/eal/linux/eal_memalloc.c:1401:50: error: '%i' directive output
may be truncated writing between 1 and 11 bytes into a region of size between 0
and 63 [-Werror=format-truncation=]
 1401 |         snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i",
      |                                                  ^~
../../src/lib/eal/linux/eal_memalloc.c:1401:9: note: 'snprintf' output between
3 and 76 bytes into a destination of size 64
 1401 |         snprintf(name, RTE_FBARRAY_NAME_LEN, "%s_%i",
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1402 |                 primary_msl->memseg_arr.name, getpid());
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the dev mailing list