[PATCH] ipc:msg: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helper

From: Atul Raut
Date: Sun Jul 30 2023 - 22:26:15 EST


Replacing zero-length arrays with C99 flexible-array members
because they are deprecated.
Use the new DECLARE_FLEX_ARRAY() auxiliary macro instead of defining
a zero-length array.

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..300c126faf2d 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];
+ DECLARE_FLEX_ARRAY(char, mtext);
};

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