From: Oleg Nesterov <oleg@redhat.com>
To: Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
Anton Arapov <anton@redhat.com>,
Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 6/6] uprobes: __copy_insn() needs "loff_t offset"
Date: Wed, 13 Jun 2012 20:51:22 +0200 [thread overview]
Message-ID: <20120613185122.GF13878@redhat.com> (raw)
In-Reply-To: <20120613184933.GA13870@redhat.com>
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>
---
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 773bb37..5ad1d77 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -581,20 +581,20 @@ static bool consumer_del(struct uprobe *uprobe, struct uprobe_consumer *uc)
static int
__copy_insn(struct address_space *mapping, struct file *filp, char *insn,
- unsigned long nbytes, unsigned long offset)
+ unsigned long nbytes, loff_t offset)
{
struct page *page;
void *vaddr;
- unsigned long off1;
- unsigned long idx;
+ unsigned long off;
+ pgoff_t idx;
if (!filp)
return -EINVAL;
if (!mapping->a_ops->readpage)
return -EIO;
- idx = (unsigned long)(offset >> PAGE_CACHE_SHIFT);
- off1 = offset &= ~PAGE_MASK;
+ idx = offset >> PAGE_CACHE_SHIFT;
+ off = offset & ~PAGE_MASK;
/*
* Ensure that the page that has the original instruction is
@@ -605,7 +605,7 @@ __copy_insn(struct address_space *mapping, struct file *filp, char *insn,
return PTR_ERR(page);
vaddr = kmap_atomic(page);
- memcpy(insn, vaddr + off1, nbytes);
+ memcpy(insn, vaddr + off, nbytes);
kunmap_atomic(vaddr);
page_cache_release(page);
--
1.5.5.1
next prev parent reply other threads:[~2012-06-13 18:53 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-13 18:49 [PATCH 0/6] uprobes: misc cleanups Oleg Nesterov
2012-06-13 18:49 ` [PATCH 1/6] uprobes: copy_insn() shouldn't depend on mm/vma/vaddr Oleg Nesterov
2012-06-13 18:50 ` [PATCH 2/6] uprobes: copy_insn() should not return -ENOMEM if __copy_insn() fails Oleg Nesterov
2012-06-13 18:50 ` [PATCH 3/6] uprobes: no need to re-check vma_address() in write_opcode() Oleg Nesterov
2012-06-13 18:50 ` [PATCH 4/6] uprobes: move BUG_ON(UPROBE_SWBP_INSN_SIZE) from write_opcode() to install_breakpoint() Oleg Nesterov
2012-06-13 18:51 ` [PATCH 5/6] uprobes: don't use loff_t for the valid virtual address Oleg Nesterov
2012-06-14 5:24 ` Ananth N Mavinakayanahalli
2012-06-14 8:38 ` Ingo Molnar
2012-06-14 8:43 ` Ananth N Mavinakayanahalli
2012-06-14 10:58 ` Anton Arapov
2012-06-14 11:05 ` [PATCH v2 " Anton Arapov
2012-06-14 17:39 ` [PATCH " Oleg Nesterov
2012-06-13 18:51 ` Oleg Nesterov [this message]
2012-06-14 5:25 ` [PATCH 0/6] uprobes: misc cleanups Ananth N Mavinakayanahalli
2012-06-14 14:54 ` Srikar Dronamraju
2012-06-14 17:44 ` Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120613185122.GF13878@redhat.com \
--to=oleg@redhat.com \
--cc=ananth@in.ibm.com \
--cc=anton@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=srikar@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox