[gustavoars:testing/WFAMNAE-next20240621-CbC 1/11] include/linux/tty_buffer.h:40:27: warning: structure containing a flexible array member is not at the end of another structure

From: kernel test robot
Date: Fri Jul 12 2024 - 00:19:53 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git testing/WFAMNAE-next20240621-CbC
head: 30867ef8ad076c11ed274d76f99e8bb0346790af
commit: 18c8dad6dac24de88b5379ad4e367e50d06a96ec [1/11] Makefile: Enable -Wflex-array-member-not-at-end globally
:::::: branch date: 5 hours ago
:::::: commit date: 2 weeks ago
config: openrisc-allnoconfig (https://download.01.org/0day-ci/archive/20240711/202407111807.R0HzhFNt-lkp@xxxxxxxxx/config)
compiler: or1k-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240711/202407111807.R0HzhFNt-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/r/202407111807.R0HzhFNt-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

In file included from include/linux/tty_port.h:8,
from include/linux/tty.h:11,
from fs/open.c:14:
>> include/linux/tty_buffer.h:40:27: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
40 | struct tty_buffer sentinel;
| ^~~~~~~~
In file included from include/linux/security.h:35,
from fs/open.c:19:
include/linux/bpf.h:2002:31: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
2002 | struct bpf_prog_array hdr;
| ^~~
--
In file included from include/linux/tty_port.h:8,
from include/linux/tty.h:11,
from fs/char_dev.c:24:
>> include/linux/tty_buffer.h:40:27: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
40 | struct tty_buffer sentinel;
| ^~~~~~~~
--
In file included from include/linux/security.h:35,
from include/linux/perf_event.h:62,
from fs/exec.c:42:
include/linux/bpf.h:2002:31: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
2002 | struct bpf_prog_array hdr;
| ^~~
In file included from arch/openrisc/include/asm/tlb.h:24,
from fs/exec.c:74:
>> include/asm-generic/tlb.h:351:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
351 | struct mmu_gather_batch local;
| ^~~~~
--
In file included from include/linux/security.h:35,
from include/linux/perf_event.h:62,
from include/linux/trace_events.h:10,
from include/trace/syscall.h:7,
from include/linux/syscalls.h:94,
from fs/select.c:22:
include/linux/bpf.h:2002:31: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
2002 | struct bpf_prog_array hdr;
| ^~~
In file included from include/net/scm.h:13,
from include/linux/netlink.h:9,
from include/uapi/linux/neighbour.h:6,
from include/linux/netdevice.h:45,
from include/net/busy_poll.h:15,
from fs/select.c:33:
>> include/net/compat.h:33:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
33 | struct sockaddr rt_dst; /* target address */
| ^~~~~~
include/net/compat.h:34:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
34 | struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */
| ^~~~~~~~~~
include/net/compat.h:35:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
35 | struct sockaddr rt_genmask; /* target network mask (IP) */
| ^~~~~~~~~~
In file included from include/net/ip.h:29,
from include/net/busy_poll.h:18:
>> include/net/inet_sock.h:64:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
64 | struct ip_options_rcu opt;
| ^~~
In file included from include/linux/if_arp.h:23,
from include/net/arp.h:6,
from include/net/route.h:28,
from include/net/ip.h:30:
>> include/uapi/linux/if_arp.h:118:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
118 | struct sockaddr arp_pa; /* protocol address */
| ^~~~~~
include/uapi/linux/if_arp.h:119:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
119 | struct sockaddr arp_ha; /* hardware address */
| ^~~~~~
include/uapi/linux/if_arp.h:121:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
121 | struct sockaddr arp_netmask; /* netmask (only for proxy arps) */
| ^~~~~~~~~~~
include/uapi/linux/if_arp.h:126:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
126 | struct sockaddr arp_pa; /* protocol address */
| ^~~~~~
include/uapi/linux/if_arp.h:127:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
127 | struct sockaddr arp_ha; /* hardware address */
| ^~~~~~
In file included from include/net/route.h:33:
>> include/uapi/linux/route.h:33:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
33 | struct sockaddr rt_dst; /* target address */
| ^~~~~~
include/uapi/linux/route.h:34:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
34 | struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */
| ^~~~~~~~~~
include/uapi/linux/route.h:35:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
35 | struct sockaddr rt_genmask; /* target network mask (IP) */
| ^~~~~~~~~~
>> include/net/ip.h:48:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
48 | struct ip_options opt; /* Compiled IP options */
| ^~~
--
In file included from include/linux/security.h:35,
from include/linux/perf_event.h:62,
from include/linux/trace_events.h:10,
from include/trace/syscall.h:7,
from include/linux/syscalls.h:94,
from fs/file.c:10:
include/linux/bpf.h:2002:31: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
2002 | struct bpf_prog_array hdr;
| ^~~
In file included from include/net/scm.h:13,
from include/linux/netlink.h:9,
from include/uapi/linux/neighbour.h:6,
from include/linux/netdevice.h:45,
from include/net/sock.h:46,
from fs/file.c:23:
>> include/net/compat.h:33:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
33 | struct sockaddr rt_dst; /* target address */
| ^~~~~~
include/net/compat.h:34:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
34 | struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */
| ^~~~~~~~~~
include/net/compat.h:35:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
35 | struct sockaddr rt_genmask; /* target network mask (IP) */
| ^~~~~~~~~~
--
In file included from include/linux/security.h:35,
from include/linux/perf_event.h:62,
from include/linux/trace_events.h:10,
from include/trace/syscall.h:7,
from include/linux/syscalls.h:94,
from fs/namespace.c:11:
include/linux/bpf.h:2002:31: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
2002 | struct bpf_prog_array hdr;
| ^~~
>> fs/namespace.c:4747:26: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
4747 | struct statmount sm;
| ^~
--
In file included from include/linux/security.h:35,
from kernel/fork.c:52:
include/linux/bpf.h:2002:31: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
2002 | struct bpf_prog_array hdr;
| ^~~
In file included from include/linux/tty_port.h:8,
from include/linux/tty.h:11,
from kernel/fork.c:80:
>> include/linux/tty_buffer.h:40:27: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
40 | struct tty_buffer sentinel;
| ^~~~~~~~
--
In file included from include/linux/security.h:35,
from kernel/sysctl.c:32:
include/linux/bpf.h:2002:31: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
2002 | struct bpf_prog_array hdr;
| ^~~
In file included from include/net/scm.h:13,
from include/linux/netlink.h:9,
from include/uapi/linux/neighbour.h:6,
from include/linux/netdevice.h:45,
from include/linux/if_vlan.h:10,
from include/linux/filter.h:21,
from kernel/sysctl.c:35:
>> include/net/compat.h:33:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
33 | struct sockaddr rt_dst; /* target address */
| ^~~~~~
include/net/compat.h:34:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
34 | struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */
| ^~~~~~~~~~
include/net/compat.h:35:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
35 | struct sockaddr rt_genmask; /* target network mask (IP) */
| ^~~~~~~~~~
In file included from include/net/inet_connection_sock.h:21,
from include/linux/tcp.h:20,
from include/linux/ipv6.h:101,
from include/net/ipv6.h:12,
from include/linux/sunrpc/clnt.h:29,
from include/linux/nfs_fs.h:32,
from kernel/sysctl.c:53:
>> include/net/inet_sock.h:64:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
64 | struct ip_options_rcu opt;
| ^~~
--
In file included from include/linux/security.h:35,
from include/net/scm.h:9,
from include/linux/netlink.h:9,
from include/uapi/linux/neighbour.h:6,
from include/linux/netdevice.h:45,
from include/net/sock.h:46,
from include/linux/tcp.h:19,
from include/linux/ipv6.h:101,
from include/net/addrconf.h:61,
from lib/vsprintf.c:41:
include/linux/bpf.h:2002:31: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
2002 | struct bpf_prog_array hdr;
| ^~~
In file included from include/net/scm.h:13:
>> include/net/compat.h:33:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
33 | struct sockaddr rt_dst; /* target address */
| ^~~~~~
include/net/compat.h:34:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
34 | struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */
| ^~~~~~~~~~
include/net/compat.h:35:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
35 | struct sockaddr rt_genmask; /* target network mask (IP) */
| ^~~~~~~~~~
In file included from include/net/inet_connection_sock.h:21,
from include/linux/tcp.h:20:
>> include/net/inet_sock.h:64:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
64 | struct ip_options_rcu opt;
| ^~~
lib/vsprintf.c: In function 'va_format':
lib/vsprintf.c:1683:9: warning: function 'va_format' might be a candidate for 'gnu_printf' format attribute [-Wsuggest-attribute=format]
1683 | buf += vsnprintf(buf, end > buf ? end - buf : 0, va_fmt->fmt, va);
| ^~~
--
In file included from include/linux/security.h:35,
from include/net/scm.h:9,
from include/linux/netlink.h:9,
from include/linux/ethtool.h:19,
from include/linux/phy.h:16,
from drivers/base/property.c:16:
include/linux/bpf.h:2002:31: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
2002 | struct bpf_prog_array hdr;
| ^~~
In file included from include/net/scm.h:13:
>> include/net/compat.h:33:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
33 | struct sockaddr rt_dst; /* target address */
| ^~~~~~
include/net/compat.h:34:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
34 | struct sockaddr rt_gateway; /* gateway addr (RTF_GATEWAY) */
| ^~~~~~~~~~
include/net/compat.h:35:25: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
35 | struct sockaddr rt_genmask; /* target network mask (IP) */
| ^~~~~~~~~~
>> include/linux/ethtool.h:170:38: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
170 | struct ethtool_link_settings base;
| ^~~~
--
In file included from arch/openrisc/include/asm/tlb.h:24,
from arch/openrisc/mm/init.c:33:
>> include/asm-generic/tlb.h:351:33: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
351 | struct mmu_gather_batch local;
| ^~~~~


vim +40 include/linux/tty_buffer.h

8d29e0024437ae Jiri Slaby 2021-07-23 34
8d29e0024437ae Jiri Slaby 2021-07-23 35 struct tty_bufhead {
8d29e0024437ae Jiri Slaby 2021-07-23 36 struct tty_buffer *head; /* Queue head */
8d29e0024437ae Jiri Slaby 2021-07-23 37 struct work_struct work;
8d29e0024437ae Jiri Slaby 2021-07-23 38 struct mutex lock;
8d29e0024437ae Jiri Slaby 2021-07-23 39 atomic_t priority;
8d29e0024437ae Jiri Slaby 2021-07-23 @40 struct tty_buffer sentinel;
8d29e0024437ae Jiri Slaby 2021-07-23 41 struct llist_head free; /* Free queue head */
8d29e0024437ae Jiri Slaby 2021-07-23 42 atomic_t mem_used; /* In-use buffers excluding free list */
8d29e0024437ae Jiri Slaby 2021-07-23 43 int mem_limit;
8d29e0024437ae Jiri Slaby 2021-07-23 44 struct tty_buffer *tail; /* Active buffer */
8d29e0024437ae Jiri Slaby 2021-07-23 45 };
8d29e0024437ae Jiri Slaby 2021-07-23 46

:::::: The code at line 40 was first introduced by commit
:::::: 8d29e0024437ae9184ae24f817ef0fda80b8cd3c tty: move tty_buffer definitions to new tty_buffer.h

:::::: TO: Jiri Slaby <jslaby@xxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki