Skip to content

Commit b51478a

Browse files
wenhuizhangtorvalds
authored andcommitted
memcontrol: use flexible-array member
Change deprecated 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 cause undefined behaviours if sizeof() used. Link: https://lkml.kernel.org/r/20210518200910.29912-1-wenhui@gwmail.gwu.edu Signed-off-by: wenhuizhang <wenhui@gwmail.gwu.edu> Reviewed-by: Muchun Song <songmuchun@bytedance.com> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Shakeel Butt <shakeelb@google.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Roman Gushchin <guro@fb.com> Cc: Muchun Song <songmuchun@bytedance.com> Cc: Yang Shi <shy828301@gmail.com> Cc: Alex Shi <alexs@kernel.org> Cc: Alexander Duyck <alexander.h.duyck@linux.intel.com> Cc: Wei Yang <richard.weiyang@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 9ef56b7 commit b51478a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

include/linux/memcontrol.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,7 @@ struct mem_cgroup {
349349
struct deferred_split deferred_split_queue;
350350
#endif
351351

352-
struct mem_cgroup_per_node *nodeinfo[0];
353-
/* WARNING: nodeinfo must be the last member here */
352+
struct mem_cgroup_per_node *nodeinfo[];
354353
};
355354

356355
/*

0 commit comments

Comments
 (0)