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
F142210705: D54730.id169917.diff
Sat, Jan 17, 7:17 AM
F142207651: D54730.id169917.diff
Sat, Jan 17, 6:11 AM
F142205751: D54730.id169911.diff
Sat, Jan 17, 5:33 AM
Unknown Object (File)
Fri, Jan 16, 10:27 PM
Unknown Object (File)
Fri, Jan 16, 5:03 AM
Unknown Object (File)
Fri, Jan 16, 12:33 AM
Unknown Object (File)
Thu, Jan 15, 9:46 PM
Unknown Object (File)
Thu, Jan 15, 8:50 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.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