Skip to content

Commit

Permalink
BACKPORT: maccess: rename strncpy_from_unsafe_user to strncpy_from_us…
Browse files Browse the repository at this point in the history
…er_nofault

This matches the naming of strncpy_from_user, and also makes it more
clear what the function is supposed to do.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20200521152301.2587579-7-hch@lst.de
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

cherry picked from torvalds/linux@bd88bb5 upstream
Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com>
  • Loading branch information
Christoph Hellwig authored and backslashxx committed Jan 26, 2025
1 parent fcdc16c commit 424e21f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/linux/uaccess.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ extern long notrace probe_user_write(void __user *dst, const void *src, size_t s
extern long notrace __probe_user_write(void __user *dst, const void *src, size_t size);

extern long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count);
extern long strncpy_from_unsafe_user(char *dst, const void __user *unsafe_addr,
long count);
long strncpy_from_user_nofault(char *dst, const void __user *unsafe_addr,
long count);
extern long strnlen_unsafe_user(const void __user *unsafe_addr, long count);

/**
Expand Down
4 changes: 2 additions & 2 deletions mm/maccess.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count)
}

/**
* strncpy_from_unsafe_user: - Copy a NUL terminated string from unsafe user
* strncpy_from_user_nofault: - Copy a NUL terminated string from unsafe user
* address.
* @dst: Destination address, in kernel space. This buffer must be at
* least @count bytes long.
Expand All @@ -198,7 +198,7 @@ long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count)
* If @count is smaller than the length of the string, copies @count-1 bytes,
* sets the last byte of @dst buffer to NUL and returns @count.
*/
long strncpy_from_unsafe_user(char *dst, const void __user *unsafe_addr,
long strncpy_from_user_nofault(char *dst, const void __user *unsafe_addr,
long count)
{
mm_segment_t old_fs = get_fs();
Expand Down

0 comments on commit 424e21f

Please sign in to comment.