Re: [PATCH 4/5][next] uapi: net: arp: Avoid -Wflex-array-member-not-at-end warnings

From: Gustavo A. R. Silva
Date: Fri Oct 18 2024 - 14:55:40 EST



These are clearly UAPI files. It would be good to state in the commit
message why this is a safe change, at the source level.

Yes, I'll update it!


I think we can avoid complicating UAPI by doing something like this in
include/uapi/linux/socket.h:

#ifdef __KERNEL__
#define __kernel_sockaddr_legacy sockaddr_legacy
#else
#define __kernel_sockaddr_legacy sockaddr
#endif

And then the UAPI changes can use __kernel_sockaddr_legacy and userspace
will resolve to sockaddr (unchanged), and the kernel internals will
resolve to sockaddr_legacy (fixing the warnings).

Here are a couple of test patches (Don't mind the changelog text):

https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?h=testing/wfamnae-next20241015-2&id=c3b631a5036cbf45b3308d563bf74a518490f3e6
https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?h=testing/wfamnae-next20241015-2&id=66db096a530b95ce0ac33f9fdec66401ec5f2204

__kernel_sockaddr_legacy seems a bit too long, but at the same time
it makes it quite clear what's going on.

Thanks
--
Gustavo