diff options
author | Oleg Nesterov <oleg@redhat.com> | 2012-06-15 11:43:59 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2012-06-16 03:10:49 -0400 |
commit | 593609a59600c8377f311b300f14deacb155b9a4 (patch) | |
tree | 28185f8e2a1b8efd3a39f51fc6ab6803420ead67 | |
parent | 816c03fbabe64fa09f66fbb64e932081af381415 (diff) |
uprobes: __copy_insn() needs "loff_t offset"
1. __copy_insn() needs "loff_t offset", not "unsigned long",
to read the file.
2. use pgoff_t for "idx" and remove the unnecessary typecast.
3. fix the typo, "&=" is not what we want
4. can't resist, rename off1 to off.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Acked-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Acked-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Anton Arapov <anton@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20120615154359.GA9625@redhat.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r-- | kernel/events/uprobes.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c index 4df84b76dd48..d1b2eeb80837 100644 --- a/kernel/events/uprobes.c +++ b/kernel/events/uprobes.c | |||
@@ -581,12 +581,12 @@ static bool consumer_del(struct uprobe *uprobe, struct uprobe_consumer *uc) | |||
581 | 581 | ||
582 | static int | 582 | static int |
583 | __copy_insn(struct address_space *mapping, struct file *filp, char *insn, | 583 | __copy_insn(struct address_space *mapping, struct file *filp, char *insn, |
584 | unsigned long nbytes, unsigned long offset) | 584 | unsigned long nbytes, loff_t offset) |
585 | { | 585 | { |
586 | struct page *page; | 586 | struct page *page; |
587 | void *vaddr; | 587 | void *vaddr; |
588 | unsigned long off1; | 588 | unsigned long off; |
589 | unsigned long idx; | 589 | pgoff_t idx; |
590 | 590 | ||
591 | if (!filp) | 591 | if (!filp) |
592 | return -EINVAL; | 592 | return -EINVAL; |
@@ -594,8 +594,8 @@ __copy_insn(struct address_space *mapping, struct file *filp, char *insn, | |||
594 | if (!mapping->a_ops->readpage) | 594 | if (!mapping->a_ops->readpage) |
595 | return -EIO; | 595 | return -EIO; |
596 | 596 | ||
597 | idx = (unsigned long)(offset >> PAGE_CACHE_SHIFT); | 597 | idx = offset >> PAGE_CACHE_SHIFT; |
598 | off1 = offset &= ~PAGE_MASK; | 598 | off = offset & ~PAGE_MASK; |
599 | 599 | ||
600 | /* | 600 | /* |
601 | * Ensure that the page that has the original instruction is | 601 | * Ensure that the page that has the original instruction is |
@@ -606,7 +606,7 @@ __copy_insn(struct address_space *mapping, struct file *filp, char *insn, | |||
606 | return PTR_ERR(page); | 606 | return PTR_ERR(page); |
607 | 607 | ||
608 | vaddr = kmap_atomic(page); | 608 | vaddr = kmap_atomic(page); |
609 | memcpy(insn, vaddr + off1, nbytes); | 609 | memcpy(insn, vaddr + off, nbytes); |
610 | kunmap_atomic(vaddr); | 610 | kunmap_atomic(vaddr); |
611 | page_cache_release(page); | 611 | page_cache_release(page); |
612 | 612 | ||