cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] [PATCH] [next] dlm: replace one-element array with fixed size array
@ 2022-10-11 19:15 Paulo Miguel Almeida
  2022-10-11 19:24 ` Gustavo A. R. Silva
  0 siblings, 1 reply; 5+ messages in thread
From: Paulo Miguel Almeida @ 2022-10-11 19:15 UTC (permalink / raw)
  To: cluster-devel.redhat.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>
---
 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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Cluster-devel] [PATCH] [next] dlm: replace one-element array with fixed size array
  2022-10-11 19:15 [Cluster-devel] [PATCH] [next] dlm: replace one-element array with fixed size array Paulo Miguel Almeida
@ 2022-10-11 19:24 ` Gustavo A. R. Silva
  2022-10-11 19:28   ` Paulo Miguel Almeida
  0 siblings, 1 reply; 5+ messages in thread
From: Gustavo A. R. Silva @ 2022-10-11 19:24 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Wed, Oct 12, 2022 at 08:15:17AM +1300, Paulo Miguel Almeida wrote:
> 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>

I think this should be versioned as v3.

> ---
>  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);

sizeof(*ls) is preferred here....^^^

--
Gustavo


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Cluster-devel] [PATCH] [next] dlm: replace one-element array with fixed size array
  2022-10-11 19:24 ` Gustavo A. R. Silva
@ 2022-10-11 19:28   ` Paulo Miguel Almeida
  2022-10-11 19:37     ` Gustavo A. R. Silva
  0 siblings, 1 reply; 5+ messages in thread
From: Paulo Miguel Almeida @ 2022-10-11 19:28 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Tue, Oct 11, 2022 at 02:24:50PM -0500, Gustavo A. R. Silva wrote:
> On Wed, Oct 12, 2022 at 08:15:17AM +1300, Paulo Miguel Almeida wrote:
> > 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>
> 
> I think this should be versioned as v3.
> 
I didn't add v3 here because the the patch got changed from 'replacing
[1]-array with flex-array' to 'replacing [1]-array to fixed-size array'.

Let me know if you still want me to send it as v3 instead.

Paulo A.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Cluster-devel] [PATCH] [next] dlm: replace one-element array with fixed size array
  2022-10-11 19:28   ` Paulo Miguel Almeida
@ 2022-10-11 19:37     ` Gustavo A. R. Silva
  2022-10-11 19:55       ` Paulo Miguel Almeida
  0 siblings, 1 reply; 5+ messages in thread
From: Gustavo A. R. Silva @ 2022-10-11 19:37 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Wed, Oct 12, 2022 at 08:28:54AM +1300, Paulo Miguel Almeida wrote:
> On Tue, Oct 11, 2022 at 02:24:50PM -0500, Gustavo A. R. Silva wrote:
> > On Wed, Oct 12, 2022 at 08:15:17AM +1300, Paulo Miguel Almeida wrote:
> > > 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>
> > 
> > I think this should be versioned as v3.
> > 
> I didn't add v3 here because the the patch got changed from 'replacing
> [1]-array with flex-array' to 'replacing [1]-array to fixed-size array'.

The issue remains the same, and there have been comments and feedback on
previous patches. So, yep, v3 seems appropiate for this patch. :)

> 
> Let me know if you still want me to send it as v3 instead.

I think next one would be v4.

Also, when versioning patches it is also necessary to include a version
change log.

Thanks
--
Gustavo


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Cluster-devel] [PATCH] [next] dlm: replace one-element array with fixed size array
  2022-10-11 19:37     ` Gustavo A. R. Silva
@ 2022-10-11 19:55       ` Paulo Miguel Almeida
  0 siblings, 0 replies; 5+ messages in thread
From: Paulo Miguel Almeida @ 2022-10-11 19:55 UTC (permalink / raw)
  To: cluster-devel.redhat.com

On Tue, Oct 11, 2022 at 02:37:40PM -0500, Gustavo A. R. Silva wrote:
> On Wed, Oct 12, 2022 at 08:28:54AM +1300, Paulo Miguel Almeida wrote:
> > > 
> > I didn't add v3 here because the the patch got changed from 'replacing
> > [1]-array with flex-array' to 'replacing [1]-array to fixed-size array'.
> 
> The issue remains the same, and there have been comments and feedback on
> previous patches. So, yep, v3 seems appropiate for this patch. :)
> 
> > 
> > Let me know if you still want me to send it as v3 instead.
> 
> I think next one would be v4.
> 
> Also, when versioning patches it is also necessary to include a version
> change log.
> 
Fair enough. Will send a v4

Paulo A.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-11 19:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-11 19:15 [Cluster-devel] [PATCH] [next] dlm: replace one-element array with fixed size array Paulo Miguel Almeida
2022-10-11 19:24 ` Gustavo A. R. Silva
2022-10-11 19:28   ` Paulo Miguel Almeida
2022-10-11 19:37     ` Gustavo A. R. Silva
2022-10-11 19:55       ` Paulo Miguel Almeida

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).