summaryrefslogtreecommitdiff
path: root/kernel/events
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2013-03-24 18:37:48 +0100
committerOleg Nesterov <oleg@redhat.com>2013-04-04 13:57:05 +0200
commit2edb7b5574d447354202ba365fb8ca6a1bac1d1c (patch)
treeb26cd1b630261aa7507652975a32510d1a987ee6 /kernel/events
parentab0d805c7b9089f9a9b291f33ab95301d6604868 (diff)
downloadlwn-2edb7b5574d447354202ba365fb8ca6a1bac1d1c.tar.gz
lwn-2edb7b5574d447354202ba365fb8ca6a1bac1d1c.zip
uprobes: Change __copy_insn() to use copy_from_page()
Change __copy_insn() to use copy_from_page() and simplify the code. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Acked-by: Anton Arapov <anton@redhat.com> Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/events')
-rw-r--r--kernel/events/uprobes.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 850eb9eb179b..ba6acfe7c0de 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -500,30 +500,21 @@ __copy_insn(struct address_space *mapping, struct file *filp, char *insn,
unsigned long nbytes, loff_t offset)
{
struct page *page;
- void *vaddr;
- unsigned long off;
- pgoff_t idx;
if (!filp)
return -EINVAL;
if (!mapping->a_ops->readpage)
return -EIO;
-
- idx = offset >> PAGE_CACHE_SHIFT;
- off = offset & ~PAGE_MASK;
-
/*
* Ensure that the page that has the original instruction is
* populated and in page-cache.
*/
- page = read_mapping_page(mapping, idx, filp);
+ page = read_mapping_page(mapping, offset >> PAGE_CACHE_SHIFT, filp);
if (IS_ERR(page))
return PTR_ERR(page);
- vaddr = kmap_atomic(page);
- memcpy(insn, vaddr + off, nbytes);
- kunmap_atomic(vaddr);
+ copy_from_page(page, offset, insn, nbytes);
page_cache_release(page);
return 0;