Page MenuHomeFreeBSD

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

Authored by dim on Thu, Jan 15, 11:33 AM.
Tags
None
Referenced Files
F142607615: D54730.id.diff
Wed, Jan 21, 11:36 AM
F142570707: D54730.diff
Wed, Jan 21, 3:27 AM
Unknown Object (File)
Tue, Jan 20, 12:36 AM
Unknown Object (File)
Mon, Jan 19, 2:54 AM
Unknown Object (File)
Sat, Jan 17, 7:17 AM
Unknown Object (File)
Sat, Jan 17, 6:11 AM
Unknown Object (File)
Sat, Jan 17, 5:33 AM
Unknown Object (File)
Fri, Jan 16, 10:27 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 Not Applicable
Unit
Tests Not Applicable

Event Timeline

dim requested review of this revision.Thu, Jan 15, 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.Fri, Jan 16, 9:14 PM