Page MenuHomeFreeBSD

netmap: silence -Wdefault-const-init-field-unsafe warning
ClosedPublic

Authored by arichardson on Sep 16 2025, 5:32 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Jul 15, 6:44 AM
Unknown Object (File)
Wed, Jul 15, 6:44 AM
Unknown Object (File)
Mon, Jul 13, 5:17 AM
Unknown Object (File)
Tue, Jul 7, 9:20 AM
Unknown Object (File)
Thu, Jun 25, 7:03 AM
Unknown Object (File)
Wed, Jun 24, 7:00 PM
Unknown Object (File)
Sun, Jun 21, 12:43 PM
Unknown Object (File)
Jun 17 2026, 2:17 AM
Subscribers

Details

Summary

The netmap_ring struct starts with various const members and rencent
clang warns about leaving them uninitialized. Having them const in the
first place is highly suspicious since they are updated with various
macros but using hand-coded __DECONST(). But fixing that is a more
invasive change that I am unable to test.

.../freebsd/sys/dev/netmap/netmap_kloop.c:320:21: error: default initialization of an object of type 'struct netmap_ring' with const member leaves the object uninitialized [-Werror,-Wdefault-const-init-field-unsafe]
  320 |         struct netmap_ring shadow_ring; /* shadow copy of the netmap_ring */
      |                            ^
.../freebsd/sys/net/netmap.h:290:16: note: member 'buf_ofs' declared 'const' here
  290 |         const int64_t   buf_ofs;
      |                         ^
Test Plan

Compiles

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable