Skip to contentSkip to conversation

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

PATCH New Atul Raut 1 participant 1 message Jul 31, 2023

lore
Share & tools
lore

Atul Raut

author
#0 lore raw

PATCH 1/1 ipc:msg: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helper

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)

---
 ipc/msg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
ipc/msg.c +1 -1
index fd08b3cb36d7..300c126faf2d 100644
@@ -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,
Signature · 1 line
2.34.1