The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Malkoot Khan <engr.mkhan1990@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Malkoot Khan <engr.mkhan1990@gmail.com>
Subject: [PATCH] ipc/msg.c: Use C99 flexible array for mtext
Date: Thu, 28 Dec 2023 18:07:06 +0000	[thread overview]
Message-ID: <20231228180706.110337-1-engr.mkhan1990@gmail.com> (raw)

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@gmail.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


                 reply	other threads:[~2023-12-28 18:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231228180706.110337-1-engr.mkhan1990@gmail.com \
    --to=engr.mkhan1990@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox