On Mon, Apr 07, 2025 at 11:11:08AM -0700, Kees Cook wrote: > On Thu, Feb 13, 2025 at 02:25:27PM -0800, Alison Schofield wrote: > > On Thu, Feb 13, 2025 at 03:29:12PM +1030, Gustavo A. R. Silva wrote: > > > -Wflex-array-member-not-at-end was introduced in GCC-14, and we are > > > getting ready to enable it, globally. > > > > > > So, in order to avoid ending up with flexible-array members in the > > > middle of other structs, we use the `__struct_group()` helper to > > > separate the flexible array from the rest of the members in the > > > flexible structure. We then use the newly created tagged `struct > > > nd_cmd_pkg_hdr` to replace the type of the objects causing trouble > > > (`pkg`) in multiple structs. > > > > > > So, with these changes, fix the following warnings: > > > > > > drivers/acpi/nfit/intel.c:692:35: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end] > > > > One sample warning is good. > > > > How about adding a comment on why the usage of __struct_group() here > > means this doesn't break userspace. > > > > snip > > > > > diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h > > > index 73516e263627..34c11644d5d7 100644 > > > --- a/include/uapi/linux/ndctl.h > > > +++ b/include/uapi/linux/ndctl.h > > > > FWIW: In a patch like this where reviewers likely want to see > > the header file change first, put it first in the diff. > > (git diff.orderfile) > > TIL about diff.orderfile! :) Just for my own education, what do you have > as the contents for your orderfile? Is it just simply: > > *.h > > ? I've updated my local environment to use this, to see how well it ends up behaving: Kconfig */Kconfig */Kconfig.* Makefile */Makefile */Makefile.* scripts/* Documentation/* *.h *.S *.c tools/testing/* https://github.com/kees/kernel-tools/commit/909db155b5cd36832d10d7d9932d7b51b46388aa -Kees -- Kees Cook