Commit e5a96cf6 authored by Wei Li's avatar Wei Li Committed by Zheng Zengkai
Browse files

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: default avatarWei Li <liwei391@huawei.com>
Reviewed-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent cf8834e7
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -396,6 +396,7 @@
# define _KABI_DEPRECATE(_type, _orig)	_type kabi_reserved_##_orig
# define _KABI_DEPRECATE_FN(_type, _orig, _args...)  \
	_type (* kabi_reserved_##_orig)(_args)
#ifdef CONFIG_KABI_RESERVE
# define _KABI_REPLACE(_orig, _new)			  \
	union {						  \
		_new;					  \
@@ -404,6 +405,9 @@
		} __UNIQUE_ID(kabi_hide);		  \
		__KABI_CHECK_SIZE_ALIGN(_orig, _new);  \
	}
#else
# define _KABI_REPLACE(_orig, _new)		KABI_BROKEN_REPLACE(_orig, _new)
#endif

# define _KABI_EXCLUDE(_elem)		_elem