Message ID | 20200519134449.1466624-21-hch@lst.de (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [01/20] maccess: unexport probe_kernel_write and probe_user_write | expand |
On Tue, 19 May 2020 15:44:49 +0200 Christoph Hellwig <hch@lst.de> wrote: > Allow the callers to distinguish a real unmapped address vs a range > that can't be probed. > > Suggested-by: Masami Hiramatsu <mhiramat@kernel.org> > Signed-off-by: Christoph Hellwig <hch@lst.de> Hi Christoph, Can you also update the kerneldoc comment too? Other than that, this looks good to me. Reviewed-by: Masami Hiramatsu <mhiramat@kernel.org> Thank you! > --- > mm/maccess.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/mm/maccess.c b/mm/maccess.c > index 1e7d77656c596..4010d64189d21 100644 > --- a/mm/maccess.c > +++ b/mm/maccess.c > @@ -25,7 +25,7 @@ bool __weak copy_from_kernel_nofault_allowed(void *dst, const void *unsafe_src, > long copy_from_kernel_nofault(void *dst, const void *src, size_t size) > { > if (!copy_from_kernel_nofault_allowed(dst, src, size)) > - return -EFAULT; > + return -ERANGE; > > pagefault_disable(); > copy_from_kernel_nofault_loop(dst, src, size, u64, Efault); > @@ -69,7 +69,7 @@ long strncpy_from_kernel_nofault(char *dst, const void *unsafe_addr, long count) > if (unlikely(count <= 0)) > return 0; > if (!copy_from_kernel_nofault_allowed(dst, unsafe_addr, count)) > - return -EFAULT; > + return -ERANGE; > > pagefault_disable(); > do { > @@ -107,7 +107,7 @@ long copy_from_kernel_nofault(void *dst, const void *src, size_t size) > mm_segment_t old_fs = get_fs(); > > if (!copy_from_kernel_nofault_allowed(dst, src, size)) > - return -EFAULT; > + return -ERANGE; > > set_fs(KERNEL_DS); > pagefault_disable(); > @@ -174,7 +174,7 @@ long strncpy_from_kernel_nofault(char *dst, const void *unsafe_addr, long count) > if (unlikely(count <= 0)) > return 0; > if (!copy_from_kernel_nofault_allowed(dst, unsafe_addr, count)) > - return -EFAULT; > + return -ERANGE; > > set_fs(KERNEL_DS); > pagefault_disable(); > -- > 2.26.2 >
On Wed, May 20, 2020 at 08:02:55PM +0900, Masami Hiramatsu wrote:
> Can you also update the kerneldoc comment too?
Sure, done.
diff --git a/mm/maccess.c b/mm/maccess.c index 1e7d77656c596..4010d64189d21 100644 --- a/mm/maccess.c +++ b/mm/maccess.c @@ -25,7 +25,7 @@ bool __weak copy_from_kernel_nofault_allowed(void *dst, const void *unsafe_src, long copy_from_kernel_nofault(void *dst, const void *src, size_t size) { if (!copy_from_kernel_nofault_allowed(dst, src, size)) - return -EFAULT; + return -ERANGE; pagefault_disable(); copy_from_kernel_nofault_loop(dst, src, size, u64, Efault); @@ -69,7 +69,7 @@ long strncpy_from_kernel_nofault(char *dst, const void *unsafe_addr, long count) if (unlikely(count <= 0)) return 0; if (!copy_from_kernel_nofault_allowed(dst, unsafe_addr, count)) - return -EFAULT; + return -ERANGE; pagefault_disable(); do { @@ -107,7 +107,7 @@ long copy_from_kernel_nofault(void *dst, const void *src, size_t size) mm_segment_t old_fs = get_fs(); if (!copy_from_kernel_nofault_allowed(dst, src, size)) - return -EFAULT; + return -ERANGE; set_fs(KERNEL_DS); pagefault_disable(); @@ -174,7 +174,7 @@ long strncpy_from_kernel_nofault(char *dst, const void *unsafe_addr, long count) if (unlikely(count <= 0)) return 0; if (!copy_from_kernel_nofault_allowed(dst, unsafe_addr, count)) - return -EFAULT; + return -ERANGE; set_fs(KERNEL_DS); pagefault_disable();
Allow the callers to distinguish a real unmapped address vs a range that can't be probed. Suggested-by: Masami Hiramatsu <mhiramat@kernel.org> Signed-off-by: Christoph Hellwig <hch@lst.de> --- mm/maccess.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)