Page MenuHomeFreeBSD

Disable -Wzero-length-bounds for the kernel for GCC 12.
ClosedPublic

Authored by jhb on Dec 7 2022, 8:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 15, 8:53 PM
Unknown Object (File)
Oct 28 2024, 5:10 PM
Unknown Object (File)
Sep 25 2024, 6:54 PM
Unknown Object (File)
Sep 23 2024, 6:09 PM
Unknown Object (File)
Sep 23 2024, 2:06 AM
Unknown Object (File)
Sep 14 2024, 11:23 AM
Unknown Object (File)
Sep 5 2024, 3:55 PM
Unknown Object (File)
Sep 5 2024, 3:55 PM
Subscribers

Details

Summary

The mlx5 driver and some other OFED bits use a somewhat dubious
pattern of:

struct foo {
    uint64_t arg[0];
    /* Real members of a struct */
};

The code then treats 'arg' as if it were really a kind of union
to such that foo.arg[N] functions similarly to (uint64_t *)foo[N].

No real bugs were found by this warning though, so just turn it off
globally.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jhb requested review of this revision.Dec 7 2022, 8:37 PM
jhb created this revision.

This is undefined behavior for sure.

This revision is now accepted and ready to land.Dec 8 2022, 1:54 AM

is there a problem disabling it just for the known problematic code?

In D37630#855698, @mjg wrote:

is there a problem disabling it just for the known problematic code?

There was a lot to disable, and I found no real bugs. That is, for amd64's GENERIC today it only yielded false positives.