提交 f29c5041 编写于 作者: S Steven Rostedt 提交者: Steven Rostedt

maccess,probe_kernel: Make write/read src const void *

The functions probe_kernel_write() and probe_kernel_read() do not modify
the src pointer. Allow const pointers to be passed in without the need
of a typecast.
Acked-by: NMike Frysinger <vapier@gentoo.org>
Acked-by: NHeiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
Link: http://lkml.kernel.org/r/1305824936.1465.4.camel@gandalf.stny.rr.com
上级 6e9101ae
...@@ -16,7 +16,7 @@ static int validate_memory_access_address(unsigned long addr, int size) ...@@ -16,7 +16,7 @@ static int validate_memory_access_address(unsigned long addr, int size)
return bfin_mem_access_type(addr, size); return bfin_mem_access_type(addr, size);
} }
long probe_kernel_read(void *dst, void *src, size_t size) long probe_kernel_read(void *dst, const void *src, size_t size)
{ {
unsigned long lsrc = (unsigned long)src; unsigned long lsrc = (unsigned long)src;
int mem_type; int mem_type;
...@@ -55,7 +55,7 @@ long probe_kernel_read(void *dst, void *src, size_t size) ...@@ -55,7 +55,7 @@ long probe_kernel_read(void *dst, void *src, size_t size)
return -EFAULT; return -EFAULT;
} }
long probe_kernel_write(void *dst, void *src, size_t size) long probe_kernel_write(void *dst, const void *src, size_t size)
{ {
unsigned long ldst = (unsigned long)dst; unsigned long ldst = (unsigned long)dst;
int mem_type; int mem_type;
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
* using the stura instruction. * using the stura instruction.
* Returns the number of bytes copied or -EFAULT. * Returns the number of bytes copied or -EFAULT.
*/ */
static long probe_kernel_write_odd(void *dst, void *src, size_t size) static long probe_kernel_write_odd(void *dst, const void *src, size_t size)
{ {
unsigned long count, aligned; unsigned long count, aligned;
int offset, mask; int offset, mask;
...@@ -45,7 +45,7 @@ static long probe_kernel_write_odd(void *dst, void *src, size_t size) ...@@ -45,7 +45,7 @@ static long probe_kernel_write_odd(void *dst, void *src, size_t size)
return rc ? rc : count; return rc ? rc : count;
} }
long probe_kernel_write(void *dst, void *src, size_t size) long probe_kernel_write(void *dst, const void *src, size_t size)
{ {
long copied = 0; long copied = 0;
......
...@@ -93,8 +93,8 @@ static inline unsigned long __copy_from_user_nocache(void *to, ...@@ -93,8 +93,8 @@ static inline unsigned long __copy_from_user_nocache(void *to,
* Safely read from address @src to the buffer at @dst. If a kernel fault * Safely read from address @src to the buffer at @dst. If a kernel fault
* happens, handle that and return -EFAULT. * happens, handle that and return -EFAULT.
*/ */
extern long probe_kernel_read(void *dst, void *src, size_t size); extern long probe_kernel_read(void *dst, const void *src, size_t size);
extern long __probe_kernel_read(void *dst, void *src, size_t size); extern long __probe_kernel_read(void *dst, const void *src, size_t size);
/* /*
* probe_kernel_write(): safely attempt to write to a location * probe_kernel_write(): safely attempt to write to a location
...@@ -105,7 +105,7 @@ extern long __probe_kernel_read(void *dst, void *src, size_t size); ...@@ -105,7 +105,7 @@ extern long __probe_kernel_read(void *dst, void *src, size_t size);
* Safely write to address @dst from the buffer at @src. If a kernel fault * Safely write to address @dst from the buffer at @src. If a kernel fault
* happens, handle that and return -EFAULT. * happens, handle that and return -EFAULT.
*/ */
extern long notrace probe_kernel_write(void *dst, void *src, size_t size); extern long notrace probe_kernel_write(void *dst, const void *src, size_t size);
extern long notrace __probe_kernel_write(void *dst, void *src, size_t size); extern long notrace __probe_kernel_write(void *dst, const void *src, size_t size);
#endif /* __LINUX_UACCESS_H__ */ #endif /* __LINUX_UACCESS_H__ */
...@@ -15,10 +15,10 @@ ...@@ -15,10 +15,10 @@
* happens, handle that and return -EFAULT. * happens, handle that and return -EFAULT.
*/ */
long __weak probe_kernel_read(void *dst, void *src, size_t size) long __weak probe_kernel_read(void *dst, const void *src, size_t size)
__attribute__((alias("__probe_kernel_read"))); __attribute__((alias("__probe_kernel_read")));
long __probe_kernel_read(void *dst, void *src, size_t size) long __probe_kernel_read(void *dst, const void *src, size_t size)
{ {
long ret; long ret;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
...@@ -43,10 +43,10 @@ EXPORT_SYMBOL_GPL(probe_kernel_read); ...@@ -43,10 +43,10 @@ EXPORT_SYMBOL_GPL(probe_kernel_read);
* Safely write to address @dst from the buffer at @src. If a kernel fault * Safely write to address @dst from the buffer at @src. If a kernel fault
* happens, handle that and return -EFAULT. * happens, handle that and return -EFAULT.
*/ */
long __weak probe_kernel_write(void *dst, void *src, size_t size) long __weak probe_kernel_write(void *dst, const void *src, size_t size)
__attribute__((alias("__probe_kernel_write"))); __attribute__((alias("__probe_kernel_write")));
long __probe_kernel_write(void *dst, void *src, size_t size) long __probe_kernel_write(void *dst, const void *src, size_t size)
{ {
long ret; long ret;
mm_segment_t old_fs = get_fs(); mm_segment_t old_fs = get_fs();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册