[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210518052038.491-1-wenhui@gwmail.gwu.edu>
Date: Tue, 18 May 2021 01:20:36 -0400
From: wenhuizhang <wenhui@...ail.gwu.edu>
To: unlisted-recipients:; (no To-header on input)
Cc: wenhui@...ail.gwu.edu, Andrew Morton <akpm@...ux-foundation.org>,
Shakeel Butt <shakeelb@...gle.com>,
Johannes Weiner <hannes@...xchg.org>,
Roman Gushchin <guro@...com>, Michal Hocko <mhocko@...e.com>,
Muchun Song <songmuchun@...edance.com>,
Yang Shi <shy828301@...il.com>, Alex Shi <alexs@...nel.org>,
Alexander Duyck <alexander.h.duyck@...ux.intel.com>,
Wei Yang <richard.weiyang@...il.com>,
linux-kernel@...r.kernel.org
Subject: [PATCH] memcontrol: use flexible-array member
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.
https://www.kernel.org/doc/html/latest/processd/deprecated.html
Signed-off-by: wenhuizhang<wenhui@...ail.gwu.edu>
---
include/linux/memcontrol.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 0ce97eff79e2..f879efb1bc6e 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -190,7 +190,7 @@ enum memcg_kmem_state {
#if defined(CONFIG_SMP)
struct memcg_padding {
- char x[0];
+ char x[];
} ____cacheline_internodealigned_in_smp;
#define MEMCG_PADDING(name) struct memcg_padding name;
#else
@@ -349,7 +349,7 @@ struct mem_cgroup {
struct deferred_split deferred_split_queue;
#endif
- struct mem_cgroup_per_node *nodeinfo[0];
+ struct mem_cgroup_per_node *nodeinfo[];
/* WARNING: nodeinfo must be the last member here */
};
--
2.17.1
Powered by blists - more mailing lists