提交 e5a96cf6 编写于 作者: W Wei Li 提交者: Zheng Zengkai

kabi: fix build error when CONFIG_KABI_RESERVE=n

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I4T1NF
CVE: NA

-------------------------------------------------

When CONFIG_KABI_RESERVE=n && CONFIG_KABI_SIZE_ALIGN_CHECKS=y, with kabi
reserved padding replaced by KABI_USE(), we will get the build error:

include/linux/kabi.h:383:3: error: static assertion failed: \
	"include/linux/fs.h:2306: long aaa is larger than . \
	Disable CONFIG_KABI_SIZE_ALIGN_CHECKS if debugging."
   _Static_assert(sizeof(struct{_new;}) <= sizeof(struct{_orig;}), \
   ^~~~~~~~~~~~~~

In fact, the result of KABI_USE() when CONFIG_KABI_RESERVE=n is weird,
update _KABI_REPLACE() to fix this.
Signed-off-by: NWei Li <liwei391@huawei.com>
Reviewed-by: NXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 cf8834e7
...@@ -396,6 +396,7 @@ ...@@ -396,6 +396,7 @@
# define _KABI_DEPRECATE(_type, _orig) _type kabi_reserved_##_orig # define _KABI_DEPRECATE(_type, _orig) _type kabi_reserved_##_orig
# define _KABI_DEPRECATE_FN(_type, _orig, _args...) \ # define _KABI_DEPRECATE_FN(_type, _orig, _args...) \
_type (* kabi_reserved_##_orig)(_args) _type (* kabi_reserved_##_orig)(_args)
#ifdef CONFIG_KABI_RESERVE
# define _KABI_REPLACE(_orig, _new) \ # define _KABI_REPLACE(_orig, _new) \
union { \ union { \
_new; \ _new; \
...@@ -404,6 +405,9 @@ ...@@ -404,6 +405,9 @@
} __UNIQUE_ID(kabi_hide); \ } __UNIQUE_ID(kabi_hide); \
__KABI_CHECK_SIZE_ALIGN(_orig, _new); \ __KABI_CHECK_SIZE_ALIGN(_orig, _new); \
} }
#else
# define _KABI_REPLACE(_orig, _new) KABI_BROKEN_REPLACE(_orig, _new)
#endif
# define _KABI_EXCLUDE(_elem) _elem # define _KABI_EXCLUDE(_elem) _elem
...@@ -426,9 +430,9 @@ ...@@ -426,9 +430,9 @@
* code. * code.
*/ */
#ifdef CONFIG_KABI_RESERVE #ifdef CONFIG_KABI_RESERVE
# define _KABI_RESERVE(n) u64 kabi_reserved##n # define _KABI_RESERVE(n) u64 kabi_reserved##n
#else #else
# define _KABI_RESERVE(n) # define _KABI_RESERVE(n)
#endif #endif
# define KABI_RESERVE(n) _KABI_RESERVE(n); # define KABI_RESERVE(n) _KABI_RESERVE(n);
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册