History

maccess: remove strncpy_from_unsafe

All users are gone now.

Christoph Hellwig committed 6 years ago

Commit 7676fbf1 parent 9de1fec2 files · +1 −39Browse files

Unified · Split

2 files
  1. include/linux/uaccess.h +0 −1
  2. mm/maccess.c +1 −38
include/linux/uaccess.h+0−1
@@ -311,7 +311,6 @@ extern long probe_user_read(void *dst, const void __user *src, size_t size); · 310 unmodified lines
311311 extern long notrace probe_kernel_write(void *dst, const void *src, size_t size);
312312 extern long notrace probe_user_write(void __user *dst, const void *src, size_t size);
313313
314−extern long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count);
315314 long strncpy_from_kernel_nofault(char *dst, const void *unsafe_addr,
316315 long count);
317316
mm/maccess.c+1−38
@@ -8,8 +8,6 @@ · 7 unmodified lines
88
99 static long __probe_kernel_read(void *dst, const void *src, size_t size,
1010 bool strict);
11−static long __strncpy_from_unsafe(char *dst, const void *unsafe_addr,
12− long count, bool strict);
1311
1412 bool __weak probe_kernel_read_allowed(const void *unsafe_src, size_t size,
1513 bool strict)
@@ -157,35 +155,6 @@ long probe_user_write(void __user *dst, const void *src, size_t size) · 141 unmodified lines
157155 }
158156 EXPORT_SYMBOL_GPL(probe_user_write);
159157
160−/**
161− * strncpy_from_unsafe: - Copy a NUL terminated string from unsafe address.
162− * @dst: Destination address, in kernel space. This buffer must be at
163− * least @count bytes long.
164− * @unsafe_addr: Unsafe address.
165− * @count: Maximum number of bytes to copy, including the trailing NUL.
166− *
167− * Copies a NUL-terminated string from unsafe address to kernel buffer.
168− *
169− * On success, returns the length of the string INCLUDING the trailing NUL.
170− *
171− * If access fails, returns -EFAULT (some data may have been copied
172− * and the trailing NUL added).
173− *
174− * If @count is smaller than the length of the string, copies @count-1 bytes,
175− * sets the last byte of @dst buffer to NUL and returns @count.
176− *
177− * Same as strncpy_from_kernel_nofault() except that for architectures with
178− * not fully separated user and kernel address spaces this function also works
179− * for user address tanges.
180− *
181− * DO NOT USE THIS FUNCTION - it is broken on architectures with entirely
182− * separate kernel and user address spaces, and also a bad idea otherwise.
183− */
184−long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count)
185−{
186− return __strncpy_from_unsafe(dst, unsafe_addr, count, false);
187−}
188−
189158 /**
190159 * strncpy_from_kernel_nofault: - Copy a NUL terminated string from unsafe
191160 * address.
@@ -205,12 +174,6 @@ long strncpy_from_unsafe(char *dst, const void *unsafe_addr, long count) · 13 unmodified lines
205174 * sets the last byte of @dst buffer to NUL and returns @count.
206175 */
207176 long strncpy_from_kernel_nofault(char *dst, const void *unsafe_addr, long count)
208−{
209− return __strncpy_from_unsafe(dst, unsafe_addr, count, true);
210−}
211−
212−static long __strncpy_from_unsafe(char *dst, const void *unsafe_addr,
213− long count, bool strict)
214177 {
215178 mm_segment_t old_fs = get_fs();
216179 const void *src = unsafe_addr;
@@ -218,7 +181,7 @@ static long __strncpy_from_unsafe(char *dst, const void *unsafe_addr, · 1 unmodified line
218181
219182 if (unlikely(count <= 0))
220183 return 0;
221− if (!probe_kernel_read_allowed(unsafe_addr, count, strict))
184+ if (!probe_kernel_read_allowed(unsafe_addr, count, true))
222185 return -EFAULT;
223186
224187 set_fs(KERNEL_DS);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t