[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20231228180706.110337-1-engr.mkhan1990@gmail.com>
Date: Thu, 28 Dec 2023 18:07:06 +0000
From: Malkoot Khan <engr.mkhan1990@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Malkoot Khan <engr.mkhan1990@...il.com>
Subject: [PATCH] ipc/msg.c: Use C99 flexible array for mtext
In the transition to C99 standards compliance, this patch replaces the
deprecated one-element array with a flexible array member. The C99 standard
introduces flexible array members for cases where the size of the array is
not known at compile time and can vary during runtime. The flexible array
'mtext[]' does not consume space in the structure itself; it's a marker for
the compiler to address variable length data directly following the struct
in memory. This approach is more aligned with modern C practices and
improves the maintainability of the kernel code.
Signed-off-by: Malkoot Khan <engr.mkhan1990@...il.com>
---
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
Powered by blists - more mailing lists