Skip to content

Commit

Permalink
s390/kprobes: use is_kernel() helper
Browse files Browse the repository at this point in the history
Use is_kernel() helper instead of is_kernel_addr().

[hca@linux.ibm.com: add missing unsigned long cast]
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
  • Loading branch information
Kefeng Wang authored and Vasily Gorbik committed Jul 5, 2021
1 parent 2bb919b commit 47f7c6c
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions arch/s390/kernel/kprobes.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,6 @@ static void copy_instruction(struct kprobe *p)
}
NOKPROBE_SYMBOL(copy_instruction);

static inline int is_kernel_addr(void *addr)
{
return addr < (void *)_end;
}

static int s390_get_insn_slot(struct kprobe *p)
{
/*
Expand All @@ -105,7 +100,7 @@ static int s390_get_insn_slot(struct kprobe *p)
* field can be patched and executed within the insn slot.
*/
p->ainsn.insn = NULL;
if (is_kernel_addr(p->addr))
if (is_kernel((unsigned long)p->addr))
p->ainsn.insn = get_s390_insn_slot();
else if (is_module_addr(p->addr))
p->ainsn.insn = get_insn_slot();
Expand All @@ -117,7 +112,7 @@ static void s390_free_insn_slot(struct kprobe *p)
{
if (!p->ainsn.insn)
return;
if (is_kernel_addr(p->addr))
if (is_kernel((unsigned long)p->addr))
free_s390_insn_slot(p->ainsn.insn, 0);
else
free_insn_slot(p->ainsn.insn, 0);
Expand Down

0 comments on commit 47f7c6c

Please sign in to comment.