[PATCH v2] ipc:msg: replace one-element array with flexible-array member

From: Atul Raut
Date: Fri Aug 04 2023 - 00:20:38 EST


One-element arrays are obsolete, and flexible
array members have taken their place. So, in
struct compat_msgbuf, replace the one-element
array with a flexible-array member.

This fixes warnings such as:
./ipc/msg.c:981:6-11: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)

Signed-off-by: Atul Raut <rauji.raut@xxxxxxxxx>
---
ipc/msg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipc/msg.c b/ipc/msg.c
index fd08b3cb36d7..ee6af4fe52bf 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -978,7 +978,7 @@ SYSCALL_DEFINE4(msgsnd, int, msqid, struct msgbuf __user *, msgp, size_t, msgsz,

struct compat_msgbuf {
compat_long_t mtype;
- char mtext[1];
+ char mtext[];
};

long compat_ksys_msgsnd(int msqid, compat_uptr_t msgp,
--
2.34.1