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
F147701486: D54730.id169917.diff
Fri, Mar 13, 1:20 AM
Unknown Object (File)
Mon, Mar 9, 10:22 AM
Unknown Object (File)
Sat, Mar 7, 8:20 PM
Unknown Object (File)
Mon, Mar 2, 11:46 PM
Unknown Object (File)
Sat, Feb 28, 12:19 PM
Unknown Object (File)
Thu, Feb 26, 9:09 PM
Unknown Object (File)
Tue, Feb 24, 3:07 AM
Unknown Object (File)
Tue, Feb 17, 1:16 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 Not Applicable
Unit
Tests Not Applicable

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