From: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH v4] [next] dlm: replace one-element array with fixed size array
Date: Wed, 12 Oct 2022 09:04:15 +1300 [thread overview]
Message-ID: <Y0XMP2RMkE4MWNPE@mail.google.com> (raw)
In-Reply-To: <Y0W5jkiXUkpNl4ap@mail.google.com>
One-element arrays are deprecated. So, replace one-element array with
fixed size array member in struct dlm_ls, and refactor the rest of the
code, accordingly.
Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/228
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836
Link: https://lore.kernel.org/lkml/Y0W5jkiXUkpNl4ap at mail.google.com/
Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
---
Changelog:
v4: resend patch using the right version number. Req: Gustavo Silva
v3: replace one-element array with a fixed size array. Req: Kees Cook
v2: patch resent as I had an issue with a <CRLF> char in my mail client
v1: https://lore.kernel.org/lkml/Y0ICbf8tCtXMn+W0 at mail.google.com/
---
fs/dlm/dlm_internal.h | 2 +-
fs/dlm/lockspace.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h
index e34c3d2639a5..94fadb619ba0 100644
--- a/fs/dlm/dlm_internal.h
+++ b/fs/dlm/dlm_internal.h
@@ -670,7 +670,7 @@ struct dlm_ls {
void *ls_ops_arg;
int ls_namelen;
- char ls_name[1];
+ char ls_name[DLM_LOCKSPACE_LEN + 1];
};
/*
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index bae050df7abf..23de0d47cbc1 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -473,7 +473,7 @@ static int new_lockspace(const char *name, const char *cluster,
error = -ENOMEM;
- ls = kzalloc(sizeof(struct dlm_ls) + namelen, GFP_NOFS);
+ ls = kzalloc(sizeof(struct dlm_ls), GFP_NOFS);
if (!ls)
goto out;
memcpy(ls->ls_name, name, namelen);
--
2.37.3
WARNING: multiple messages have this Message-ID (diff)
From: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
To: Christine Caulfield <ccaulfie@redhat.com>,
David Teigland <teigland@redhat.com>,
cluster-devel@redhat.com
Cc: linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org,
paulo.miguel.almeida.rodenas@gmail.com
Subject: [PATCH v4] [next] dlm: replace one-element array with fixed size array
Date: Wed, 12 Oct 2022 09:04:15 +1300 [thread overview]
Message-ID: <Y0XMP2RMkE4MWNPE@mail.google.com> (raw)
In-Reply-To: <Y0W5jkiXUkpNl4ap@mail.google.com>
One-element arrays are deprecated. So, replace one-element array with
fixed size array member in struct dlm_ls, and refactor the rest of the
code, accordingly.
Link: https://github.com/KSPP/linux/issues/79
Link: https://github.com/KSPP/linux/issues/228
Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101836
Link: https://lore.kernel.org/lkml/Y0W5jkiXUkpNl4ap@mail.google.com/
Signed-off-by: Paulo Miguel Almeida <paulo.miguel.almeida.rodenas@gmail.com>
---
Changelog:
v4: resend patch using the right version number. Req: Gustavo Silva
v3: replace one-element array with a fixed size array. Req: Kees Cook
v2: patch resent as I had an issue with a <CRLF> char in my mail client
v1: https://lore.kernel.org/lkml/Y0ICbf8tCtXMn+W0@mail.google.com/
---
fs/dlm/dlm_internal.h | 2 +-
fs/dlm/lockspace.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/dlm/dlm_internal.h b/fs/dlm/dlm_internal.h
index e34c3d2639a5..94fadb619ba0 100644
--- a/fs/dlm/dlm_internal.h
+++ b/fs/dlm/dlm_internal.h
@@ -670,7 +670,7 @@ struct dlm_ls {
void *ls_ops_arg;
int ls_namelen;
- char ls_name[1];
+ char ls_name[DLM_LOCKSPACE_LEN + 1];
};
/*
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index bae050df7abf..23de0d47cbc1 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -473,7 +473,7 @@ static int new_lockspace(const char *name, const char *cluster,
error = -ENOMEM;
- ls = kzalloc(sizeof(struct dlm_ls) + namelen, GFP_NOFS);
+ ls = kzalloc(sizeof(struct dlm_ls), GFP_NOFS);
if (!ls)
goto out;
memcpy(ls->ls_name, name, namelen);
--
2.37.3
next prev parent reply other threads:[~2022-10-11 20:04 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-08 23:17 [Cluster-devel] [PATCH v2][next] dlm: Replace one-element array with flexible-array member Paulo Miguel Almeida
2022-10-08 23:17 ` Paulo Miguel Almeida
2022-10-09 0:18 ` [Cluster-devel] " Kees Cook
2022-10-09 0:18 ` Kees Cook
2022-10-09 2:05 ` [Cluster-devel] " Paulo Miguel Almeida
2022-10-09 2:05 ` Paulo Miguel Almeida
2022-10-09 4:03 ` [Cluster-devel] " Kees Cook
2022-10-09 4:03 ` Kees Cook
2022-10-10 21:00 ` [Cluster-devel] " David Teigland
2022-10-10 21:00 ` David Teigland
2022-10-10 22:35 ` [Cluster-devel] " Kees Cook
2022-10-10 22:35 ` Kees Cook
2022-10-11 15:20 ` [Cluster-devel] " David Teigland
2022-10-11 15:20 ` David Teigland
2022-10-11 18:44 ` [Cluster-devel] " Paulo Miguel Almeida
2022-10-11 18:44 ` Paulo Miguel Almeida
2022-10-11 20:04 ` Paulo Miguel Almeida [this message]
2022-10-11 20:04 ` [PATCH v4] [next] dlm: replace one-element array with fixed size array Paulo Miguel Almeida
2022-10-11 20:06 ` [Cluster-devel] " Kees Cook
2022-10-11 20:06 ` Kees Cook
2022-10-11 20:11 ` [Cluster-devel] " Paulo Miguel Almeida
2022-10-11 20:11 ` Paulo Miguel Almeida
2022-10-11 20:23 ` [Cluster-devel] [PATCH v5] " Paulo Miguel Almeida
2022-10-11 20:23 ` Paulo Miguel Almeida
2022-10-11 20:26 ` [Cluster-devel] " Gustavo A. R. Silva
2022-10-11 20:26 ` Gustavo A. R. Silva
2022-10-11 22:18 ` [Cluster-devel] " Kees Cook
2022-10-11 22:18 ` Kees Cook
2022-11-04 5:00 ` [Cluster-devel] " Paulo Miguel Almeida
2022-11-04 5:00 ` Paulo Miguel Almeida
2022-11-04 17:50 ` [Cluster-devel] " Alexander Aring
2022-11-04 17:50 ` Alexander Aring
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=Y0XMP2RMkE4MWNPE@mail.google.com \
--to=paulo.miguel.almeida.rodenas@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.