Skip to content

Commit

Permalink
memcontrol: use flexible-array member
Browse files Browse the repository at this point in the history
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/[email protected]
Signed-off-by: wenhuizhang <[email protected]>
Reviewed-by: Muchun Song <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Shakeel Butt <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Roman Gushchin <[email protected]>
Cc: Muchun Song <[email protected]>
Cc: Yang Shi <[email protected]>
Cc: Alex Shi <[email protected]>
Cc: Alexander Duyck <[email protected]>
Cc: Wei Yang <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
wenhuizhang authored and torvalds committed Jun 29, 2021
1 parent 9ef56b7 commit b51478a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions include/linux/memcontrol.h
Original file line number Diff line number Diff line change
Expand Up @@ -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[];
};

/*
Expand Down

0 comments on commit b51478a

Please sign in to comment.