linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] memcontrol: use flexible-array member
@ 2021-05-18 20:09 wenhuizhang
  2021-05-19  2:45 ` [External] " Muchun Song
  2021-05-25 11:28 ` Michal Hocko
  0 siblings, 2 replies; 3+ messages in thread
From: wenhuizhang @ 2021-05-18 20:09 UTC (permalink / raw)
  Cc: wenhui, Andrew Morton, Shakeel Butt, Johannes Weiner,
	Roman Gushchin, Michal Hocko, Muchun Song, Yang Shi, Alex Shi,
	Alexander Duyck, Wei Yang, linux-kernel

Change depracated zero-length-and-one-element-arrays into flexible
array member.Zero-length and one-element arrays detected by Lukas's CodeChecker.
Zero/one element arrays causes undefined behaviours if sizeof() used.

Signed-off-by: wenhuizhang <wenhui@gwmail.gwu.edu>
---
 include/linux/memcontrol.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 0ce97eff79e2..3cc18c2176e7 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -349,8 +349,7 @@ struct mem_cgroup {
 	struct deferred_split deferred_split_queue;
 #endif
 
-	struct mem_cgroup_per_node *nodeinfo[0];
-	/* WARNING: nodeinfo must be the last member here */
+	struct mem_cgroup_per_node *nodeinfo[];
 };
 
 /*
-- 
2.17.1


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

* Re: [External] [PATCH v2] memcontrol: use flexible-array member
  2021-05-18 20:09 [PATCH v2] memcontrol: use flexible-array member wenhuizhang
@ 2021-05-19  2:45 ` Muchun Song
  2021-05-25 11:28 ` Michal Hocko
  1 sibling, 0 replies; 3+ messages in thread
From: Muchun Song @ 2021-05-19  2:45 UTC (permalink / raw)
  To: wenhuizhang
  Cc: Andrew Morton, Shakeel Butt, Johannes Weiner, Roman Gushchin,
	Michal Hocko, Yang Shi, Alex Shi, Alexander Duyck, Wei Yang,
	LKML

On Wed, May 19, 2021 at 4:09 AM wenhuizhang <wenhui@gwmail.gwu.edu> wrote:
>
> Change depracated zero-length-and-one-element-arrays into flexible

s/depracated/deprecated/g

> array member.Zero-length and one-element arrays detected by Lukas's CodeChecker.
> Zero/one element arrays causes undefined behaviours if sizeof() used.

s/causes/cause/g

>
> Signed-off-by: wenhuizhang <wenhui@gwmail.gwu.edu>

Reviewed-by: Muchun Song <songmuchun@bytedance.com>

Thanks.

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

* Re: [PATCH v2] memcontrol: use flexible-array member
  2021-05-18 20:09 [PATCH v2] memcontrol: use flexible-array member wenhuizhang
  2021-05-19  2:45 ` [External] " Muchun Song
@ 2021-05-25 11:28 ` Michal Hocko
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Hocko @ 2021-05-25 11:28 UTC (permalink / raw)
  To: wenhuizhang
  Cc: Andrew Morton, Shakeel Butt, Johannes Weiner, Roman Gushchin,
	Muchun Song, Yang Shi, Alex Shi, Alexander Duyck, Wei Yang,
	linux-kernel

On Tue 18-05-21 16:09:08, wenhuizhang wrote:
> Change depracated zero-length-and-one-element-arrays into flexible
> array member.Zero-length and one-element arrays detected by Lukas's CodeChecker.
> Zero/one element arrays causes undefined behaviours if sizeof() used.
> 
> Signed-off-by: wenhuizhang <wenhui@gwmail.gwu.edu>

Acked-by: Michal Hocko <mhocko@suse.com>

Thanks!
> ---
>  include/linux/memcontrol.h | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index 0ce97eff79e2..3cc18c2176e7 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -349,8 +349,7 @@ struct mem_cgroup {
>  	struct deferred_split deferred_split_queue;
>  #endif
>  
> -	struct mem_cgroup_per_node *nodeinfo[0];
> -	/* WARNING: nodeinfo must be the last member here */
> +	struct mem_cgroup_per_node *nodeinfo[];
>  };
>  
>  /*
> -- 
> 2.17.1

-- 
Michal Hocko
SUSE Labs

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

end of thread, other threads:[~2021-05-25 11:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 20:09 [PATCH v2] memcontrol: use flexible-array member wenhuizhang
2021-05-19  2:45 ` [External] " Muchun Song
2021-05-25 11:28 ` Michal Hocko

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