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
F171371808: D54730.id169911.diff
Thu, Sep 10, 6:19 PM
Unknown Object (File)
Fri, Sep 4, 12:58 AM
Unknown Object (File)
Thu, Sep 3, 11:18 PM
Unknown Object (File)
Wed, Sep 2, 12:34 AM
Unknown Object (File)
Tue, Sep 1, 11:03 PM
Unknown Object (File)
Mon, Aug 31, 9:10 AM
Unknown Object (File)
Mon, Aug 31, 12:17 AM
Unknown Object (File)
Sun, Aug 30, 11:16 PM
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