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)
Feb 23 2024, 12:34 AM
Unknown Object (File)
Feb 23 2024, 12:34 AM
Unknown Object (File)
Feb 23 2024, 12:33 AM
Unknown Object (File)
Feb 23 2024, 12:21 AM
Unknown Object (File)
Feb 20 2024, 8:53 AM
Unknown Object (File)
Jan 7 2024, 6:17 AM
Unknown Object (File)
Dec 23 2023, 1:15 AM
Unknown Object (File)
Nov 25 2023, 7: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.