On Fri, 2011-11-18 at 16:38 +0530, Srikar Dronamraju wrote: > +static int read_opcode(struct mm_struct *mm, unsigned long vaddr, > + uprobe_opcode_t *opcode) > +{ > + struct page *page; > + void *vaddr_new; > + int ret; > + > + ret = get_user_pages(NULL, mm, vaddr, 1, 0, 0, &page, NULL); > + if (ret <= 0) > + return ret; > + > + lock_page(page); > + vaddr_new = kmap_atomic(page); > + vaddr &= ~PAGE_MASK; BUG_ON(vaddr + uprobe_opcode_sz >= PAGE_SIZE); > + memcpy(opcode, vaddr_new + vaddr, uprobe_opcode_sz); > + kunmap_atomic(vaddr_new); > + unlock_page(page); > + put_page(page); /* we did a get_user_pages in the beginning */ > + return 0; > +} -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>