[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130325103052.GB8163@bandura.brq.redhat.com>
Date: Mon, 25 Mar 2013 11:30:52 +0100
From: Anton Arapov <anton@...hat.com>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
LKML <linux-kernel@...r.kernel.org>,
Josh Stone <jistone@...hat.com>,
Frank Eigler <fche@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...e.hu>,
Ananth N Mavinakayanahalli <ananth@...ibm.com>,
adrian.m.negreanu@...el.com, Torsten.Polle@....de
Subject: Re: [PATCH 1/5] uprobes: Turn copy_opcode() into copy_from_page()
On Sun, Mar 24, 2013 at 07:21:10PM +0100, Oleg Nesterov wrote:
> No functional changes. Rename copy_opcode() into copy_from_page() and
> add the new "int len" argument to make it more more generic for the
> new users.
>
> Signed-off-by: Oleg Nesterov <oleg@...hat.com>
> ---
> kernel/events/uprobes.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index 5c273b3..d6891cb 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -173,10 +173,10 @@ bool __weak is_swbp_insn(uprobe_opcode_t *insn)
> return *insn == UPROBE_SWBP_INSN;
> }
>
> -static void copy_opcode(struct page *page, unsigned long vaddr, uprobe_opcode_t *opcode)
> +static void copy_from_page(struct page *page, unsigned long vaddr, void *dst, int len)
> {
> void *kaddr = kmap_atomic(page);
> - memcpy(opcode, kaddr + (vaddr & ~PAGE_MASK), UPROBE_SWBP_INSN_SIZE);
> + memcpy(dst, kaddr + (vaddr & ~PAGE_MASK), len);
> kunmap_atomic(kaddr);
> }
>
> @@ -185,7 +185,7 @@ static int verify_opcode(struct page *page, unsigned long vaddr, uprobe_opcode_t
> uprobe_opcode_t old_opcode;
> bool is_swbp;
>
> - copy_opcode(page, vaddr, &old_opcode);
> + copy_from_page(page, vaddr, &old_opcode, UPROBE_SWBP_INSN_SIZE);
> is_swbp = is_swbp_insn(&old_opcode);
>
> if (is_swbp_insn(new_opcode)) {
> @@ -1449,7 +1449,7 @@ static int is_swbp_at_addr(struct mm_struct *mm, unsigned long vaddr)
> if (result < 0)
> return result;
>
> - copy_opcode(page, vaddr, &opcode);
> + copy_from_page(page, vaddr, &opcode, UPROBE_SWBP_INSN_SIZE);
> put_page(page);
> out:
> return is_swbp_insn(&opcode);
> --
> 1.5.5.1
>
Acked-by: Anton Arapov <anton@...hat.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists