diff options
author | Oleg Nesterov <oleg@redhat.com> | 2013-03-24 14:04:36 -0400 |
---|---|---|
committer | Oleg Nesterov <oleg@redhat.com> | 2013-04-04 07:57:06 -0400 |
commit | 3f47107c5c2972ca47f216889080f6ef818b25e3 (patch) | |
tree | 04ecd196e2f307dded5e80a1cb19cab389652722 /kernel/events | |
parent | 5669ccee21d87622f30a724b3fe0d04ec5b0afae (diff) |
uprobes: Change write_opcode() to use copy_*page()
Change write_opcode() to use copy_highpage() + copy_to_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.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index b8255eaca190..7312503caf2e 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c | |||
@@ -255,7 +255,6 @@ static int write_opcode(struct mm_struct *mm, unsigned long vaddr, | |||
255 | uprobe_opcode_t opcode) | 255 | uprobe_opcode_t opcode) |
256 | { | 256 | { |
257 | struct page *old_page, *new_page; | 257 | struct page *old_page, *new_page; |
258 | void *vaddr_old, *vaddr_new; | ||
259 | struct vm_area_struct *vma; | 258 | struct vm_area_struct *vma; |
260 | int ret; | 259 | int ret; |
261 | 260 | ||
@@ -276,15 +275,8 @@ retry: | |||
276 | 275 | ||
277 | __SetPageUptodate(new_page); | 276 | __SetPageUptodate(new_page); |
278 | 277 | ||
279 | /* copy the page now that we've got it stable */ | 278 | copy_highpage(new_page, old_page); |
280 | vaddr_old = kmap_atomic(old_page); | 279 | copy_to_page(new_page, vaddr, &opcode, UPROBE_SWBP_INSN_SIZE); |
281 | vaddr_new = kmap_atomic(new_page); | ||
282 | |||
283 | memcpy(vaddr_new, vaddr_old, PAGE_SIZE); | ||
284 | memcpy(vaddr_new + (vaddr & ~PAGE_MASK), &opcode, UPROBE_SWBP_INSN_SIZE); | ||
285 | |||
286 | kunmap_atomic(vaddr_new); | ||
287 | kunmap_atomic(vaddr_old); | ||
288 | 280 | ||
289 | ret = anon_vma_prepare(vma); | 281 | ret = anon_vma_prepare(vma); |
290 | if (ret) | 282 | if (ret) |