OpenCloudOS-Kernel/include/linux/sched
Gustavo A. R. Silva fe946db6ca sched: topology.h: Replace zero-length array with flexible-array member
The current codebase makes use of the zero-length array language
extension to the C90 standard, but the preferred mechanism to declare
variable-length types such as these ones is a flexible array member[1][2],
introduced in C99:

struct foo {
        int stuff;
        struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by
this change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 7649773293 ("cxgb3/l2t: Fix undefined behaviour")

Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
2020-04-18 15:44:56 -05:00
..
autogroup.h
clock.h
coredump.h
cpufreq.h sched/fair: Remove redundant call to cpufreq_update_util() 2020-01-17 10:19:22 +01:00
cputime.h posix-cpu-timers: Move state tracking to struct posix_cputimers 2019-08-28 11:50:42 +02:00
deadline.h cpusets: Rebuild root domain deadline accounting information 2019-07-25 15:55:01 +02:00
debug.h
hotplug.h
idle.h
init.h
isolation.h genirq, sched/isolation: Isolate from handling managed interrupts 2020-01-22 16:29:49 +01:00
jobctl.h cgroup: cgroup v2 freezer 2019-04-19 11:26:48 -07:00
loadavg.h
mm.h exit/exec: Seperate mm_release() 2019-11-20 09:40:08 +01:00
nohz.h timers/nohz: Update NOHZ load in remote tick 2020-01-28 21:36:44 +01:00
numa_balancing.h sched/fair: Don't free p->numa_faults with concurrent readers 2019-07-25 15:37:04 +02:00
prio.h
rt.h
signal.h Merge branch 'akpm' (patches from Andrew) 2020-04-02 13:55:34 -07:00
smt.h
stat.h
sysctl.h sched/uclamp: Add system default clamps 2019-06-24 19:23:45 +02:00
task.h clone3: allow spawning processes into cgroups 2020-02-12 17:57:51 -05:00
task_stack.h
topology.h sched: topology.h: Replace zero-length array with flexible-array member 2020-04-18 15:44:56 -05:00
types.h posix-cpu-timers: Provide array based access to expiry cache 2019-08-28 11:50:35 +02:00
user.h keys: Move the user and user-session keyrings to the user_namespace 2019-06-26 21:02:32 +01:00
wake_q.h locking/rwsem: Always release wait_lock before waking up tasks 2019-06-17 12:28:00 +02:00
xacct.h