提交 7b8328e5 编写于 作者: L Li Huafei 提交者: Zheng Zengkai

livepatch: Delete the duplicate code of klp_compare_address()

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5CJ7X

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

Delete the duplicate code of klp_compare_address() in each arch.
Signed-off-by: NLi Huafei <lihuafei1@huawei.com>
Reviewed-by: NXu Kuohai <xukuohai@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 87544d70
......@@ -86,16 +86,6 @@ static inline unsigned long klp_size_to_check(unsigned long func_size,
return size;
}
static inline int klp_compare_address(unsigned long pc, unsigned long func_addr,
const char *func_name, unsigned long check_size)
{
if (pc >= func_addr && pc < func_addr + check_size) {
pr_err("func %s is in use!\n", func_name);
return -EBUSY;
}
return 0;
}
static bool check_jump_insn(unsigned long func_addr)
{
unsigned long i;
......
......@@ -80,16 +80,6 @@ static inline unsigned long klp_size_to_check(unsigned long func_size,
return size;
}
static inline int klp_compare_address(unsigned long pc, unsigned long func_addr,
const char *func_name, unsigned long check_size)
{
if (pc >= func_addr && pc < func_addr + check_size) {
pr_err("func %s is in use!\n", func_name);
return -EBUSY;
}
return 0;
}
static bool check_jump_insn(unsigned long func_addr)
{
unsigned long i;
......
......@@ -83,16 +83,6 @@ static inline unsigned long klp_size_to_check(unsigned long func_size,
return size;
}
static inline int klp_compare_address(unsigned long pc, unsigned long func_addr,
const char *func_name, unsigned long check_size)
{
if (pc >= func_addr && pc < func_addr + check_size) {
pr_err("func %s is in use!\n", func_name);
return -EBUSY;
}
return 0;
}
static bool check_jump_insn(unsigned long func_addr)
{
unsigned long i;
......
......@@ -89,16 +89,6 @@ static inline unsigned long klp_size_to_check(unsigned long func_size,
return size;
}
static inline int klp_compare_address(unsigned long pc, unsigned long func_addr,
const char *func_name, unsigned long check_size)
{
if (pc >= func_addr && pc < func_addr + check_size) {
pr_err("func %s is in use!\n", func_name);
return -EBUSY;
}
return 0;
}
static bool check_jump_insn(unsigned long func_addr)
{
unsigned long i;
......
......@@ -66,17 +66,6 @@ static inline unsigned long klp_size_to_check(unsigned long func_size,
return size;
}
static inline int klp_compare_address(unsigned long stack_addr,
unsigned long func_addr, const char *func_name,
unsigned long check_size)
{
if (stack_addr >= func_addr && stack_addr < func_addr + check_size) {
pr_err("func %s is in use!\n", func_name);
return -EBUSY;
}
return 0;
}
static bool check_jump_insn(unsigned long func_addr)
{
int len = JMP_E9_INSN_SIZE;
......
......@@ -234,6 +234,18 @@ struct klp_func_node {
struct klp_func_node *klp_find_func_node(const void *old_func);
void klp_add_func_node(struct klp_func_node *func_node);
void klp_del_func_node(struct klp_func_node *func_node);
static inline
int klp_compare_address(unsigned long pc, unsigned long func_addr,
const char *func_name, unsigned long check_size)
{
if (pc >= func_addr && pc < func_addr + check_size) {
pr_err("func %s is in use!\n", func_name);
return -EBUSY;
}
return 0;
}
#endif
int klp_apply_section_relocs(struct module *pmod, Elf_Shdr *sechdrs,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册