diff options
| author | Doug Ledford <dledford@redhat.com> | 2017-07-17 18:26:58 +0300 |
|---|---|---|
| committer | Doug Ledford <dledford@redhat.com> | 2017-07-17 18:26:58 +0300 |
| commit | 3d886aa3be15439e05784ac1cbd4acc2f13c0048 (patch) | |
| tree | 5d7d5943c7f6697e640bdd684a560e9af7942300 /include/linux/kernel.h | |
| parent | b6ea01ba3fe9dcb5e08bbd9ed482845582a1e80b (diff) | |
| parent | 5771a8c08880cdca3bfb4a3fc6d309d6bba20877 (diff) | |
| download | linux-3d886aa3be15439e05784ac1cbd4acc2f13c0048.tar.xz | |
Merge tag 'v4.13-rc1' into k.o/for-4.13-rc
Linux v4.13-rc1
Diffstat (limited to 'include/linux/kernel.h')
| -rw-r--r-- | include/linux/kernel.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 13bc08aba704..bd6d96cf80b1 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -11,6 +11,7 @@ #include <linux/log2.h> #include <linux/typecheck.h> #include <linux/printk.h> +#include <linux/build_bug.h> #include <asm/byteorder.h> #include <uapi/linux/kernel.h> @@ -490,9 +491,13 @@ extern int root_mountflags; extern bool early_boot_irqs_disabled; -/* Values used for system_state */ +/* + * Values used for system_state. Ordering of the states must not be changed + * as code checks for <, <=, >, >= STATE. + */ extern enum system_states { SYSTEM_BOOTING, + SYSTEM_SCHEDULING, SYSTEM_RUNNING, SYSTEM_HALT, SYSTEM_POWER_OFF, @@ -850,9 +855,12 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } * @member: the name of the member within the struct. * */ -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) +#define container_of(ptr, type, member) ({ \ + void *__mptr = (void *)(ptr); \ + BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \ + !__same_type(*(ptr), void), \ + "pointer type mismatch in container_of()"); \ + ((type *)(__mptr - offsetof(type, member))); }) /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */ #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
