Page MenuHomeFreeBSD

mxge(4): avoid clang 21 warning in NO-IP configuration
ClosedPublic

Authored by dim on Jan 15 2026, 11:33 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Feb 17, 1:16 AM
Unknown Object (File)
Sun, Feb 15, 10:35 PM
Unknown Object (File)
Tue, Feb 3, 3:17 PM
Unknown Object (File)
Thu, Jan 29, 3:26 AM
Unknown Object (File)
Mon, Jan 26, 1:37 PM
Unknown Object (File)
Mon, Jan 26, 1:25 PM
Unknown Object (File)
Sun, Jan 25, 9:22 AM
Unknown Object (File)
Sun, Jan 25, 6:37 AM
Subscribers
None

Details

Summary

Building the LINT-NOIP kernel on amd64 with clang 21 results in a
-Werror warning similar to:

sys/dev/mxge/if_mxge.c:1846:44: error: variable 'sum' is uninitialized when passed as a const pointer argument here [-Werror,-Wuninitialized-const-pointer]
 1846 |                     cksum_offset, sizeof(sum), (caddr_t)&sum);
      |                                                          ^~~

Indeed, if both INET and INET6 are undefined, sum is never
initialized.

I don't know if it makes sense to set a checksum in the TCP header at
all in that configuration, but a simple solution to avoid the warning is
to skip the m_copyback call completely.

Alternatively, sum could be set to zero or another appropriate value,
but I have no idea what is correct here.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 69937
Build 66820: arc lint + arc unit

Event Timeline

dim requested review of this revision.Jan 15 2026, 11:33 AM
dim created this revision.

Initialize sum to zero instead, otherwise we get a "unused variable
'sum'" warning, which also breaks the build.

It's really an esoteric case: INET and INET6 are disabled, and then you
would have to hit a path where TSO is used. Seems very unlikely, and in
that case a zero checksum is probably fine.

This revision is now accepted and ready to land.Jan 16 2026, 9:14 PM