On Thu, Jul 11, 2013 at 11:36 PM, Dave Hansen <dave.hansen@xxxxxxxxx> wrote: > On 07/11/2013 07:34 PM, Colin Cross wrote: >> + pages_pinned = get_user_pages(current, mm, page_start_vaddr, >> + 1, 0, 0, &page, NULL); >> + if (pages_pinned < 1) { >> + seq_puts(m, "<fault>]"); >> + return; >> + } >> + >> + kaddr = (const char *)kmap(page); >> + len = min(max_len, PAGE_SIZE - page_offset); >> + write_len = strnlen(kaddr + page_offset, len); >> + seq_write(m, kaddr + page_offset, write_len); >> + kunmap(page); >> + put_page(page); > > This looks a bit like access_process_vm()? Can you perhaps use it here? It's a lot like __access_remote_vm, and this pattern is repeated in many other places in the kernel. I didn't try to reuse any of them because I wanted to stop reading at a null byte and __access_remote_vm would read the full NAME_MAX every time. I was also avoiding having to allocate a NAME_MAX sized buffer to copy into, instead passing the mapped user page directly to seq_write. -- 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/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>