ipc/msg.c: Use C99 flexible array for mtext
PATCH 1/1 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 <[email protected]>
--- ipc/msg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ipc/msg.c +1 -1
@@ -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,
Signature · 1 line
2.34.1