2011-05-19 17:09:00

by Steven Rostedt

[permalink] [raw]
Subject: [RFC][PATCH] maccess,probe_kernel: Make write/read src const void *

Can I get Acked-by's from the S390 and Blackfin maintainers please.

Thanks!

-- Steve



maccess,probe_kernel: Make 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.

Signed-off-by: Steven Rostedt <[email protected]>

arch/blackfin/mm/maccess.c | 4 ++--
arch/s390/mm/maccess.c | 4 ++--
include/linux/uaccess.h | 8 ++++----
mm/maccess.c | 8 ++++----
4 files changed, 12 insertions(+), 12 deletions(-)

Index: linux-trace.git/arch/blackfin/mm/maccess.c
===================================================================
--- linux-trace.git.orig/arch/blackfin/mm/maccess.c
+++ linux-trace.git/arch/blackfin/mm/maccess.c
@@ -16,7 +16,7 @@ static int validate_memory_access_addres
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;
int mem_type;
@@ -55,7 +55,7 @@ long probe_kernel_read(void *dst, void *
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;
int mem_type;
Index: linux-trace.git/arch/s390/mm/maccess.c
===================================================================
--- linux-trace.git.orig/arch/s390/mm/maccess.c
+++ linux-trace.git/arch/s390/mm/maccess.c
@@ -19,7 +19,7 @@
* using the stura instruction.
* 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;
int offset, mask;
@@ -45,7 +45,7 @@ static long probe_kernel_write_odd(void
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;

Index: linux-trace.git/include/linux/uaccess.h
===================================================================
--- linux-trace.git.orig/include/linux/uaccess.h
+++ linux-trace.git/include/linux/uaccess.h
@@ -93,8 +93,8 @@ static inline unsigned long __copy_from_
* Safely read from address @src to the buffer at @dst. If a kernel fault
* 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, 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, const void *src, size_t size);

/*
* probe_kernel_write(): safely attempt to write to a location
@@ -105,7 +105,7 @@ extern long __probe_kernel_read(void *ds
* Safely write to address @dst from the buffer at @src. If a kernel fault
* 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, 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, const void *src, size_t size);

#endif /* __LINUX_UACCESS_H__ */
Index: linux-trace.git/mm/maccess.c
===================================================================
--- linux-trace.git.orig/mm/maccess.c
+++ linux-trace.git/mm/maccess.c
@@ -15,10 +15,10 @@
* 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")));

-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;
mm_segment_t old_fs = get_fs();
@@ -43,10 +43,10 @@ EXPORT_SYMBOL_GPL(probe_kernel_read);
* Safely write to address @dst from the buffer at @src. If a kernel fault
* 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")));

-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;
mm_segment_t old_fs = get_fs();


2011-05-19 19:18:31

by Mike Frysinger

[permalink] [raw]
Subject: Re: [RFC][PATCH] maccess,probe_kernel: Make write/read src const void *

On Thu, May 19, 2011 at 13:08, Steven Rostedt <[email protected]> wrote:
> maccess,probe_kernel: Make 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.
>
>  arch/blackfin/mm/maccess.c |    4 ++--

Acked-by: Mike Frysinger <[email protected]>
-mike

2011-05-20 09:51:19

by Heiko Carstens

[permalink] [raw]
Subject: Re: [RFC][PATCH] maccess,probe_kernel: Make write/read src const void *

On Thu, May 19, 2011 at 01:08:56PM -0400, Steven Rostedt wrote:
> maccess,probe_kernel: Make 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.
>
> Signed-off-by: Steven Rostedt <[email protected]>
>

[...]

> arch/s390/mm/maccess.c | 4 ++--

Acked-by: Heiko Carstens <[email protected]>

2011-05-20 11:01:28

by Martin Schwidefsky

[permalink] [raw]
Subject: Re: [RFC][PATCH] maccess,probe_kernel: Make write/read src const void *

On Thu, 19 May 2011 13:08:56 -0400
Steven Rostedt <[email protected]> wrote:

> maccess,probe_kernel: Make 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.
>
> Signed-off-by: Steven Rostedt <[email protected]>

Acked-by: Martin Schwidefsky <[email protected]>

--
blue skies,
Martin.

"Reality continues to ruin my life." - Calvin.

2011-05-27 12:44:34

by Steven Rostedt

[permalink] [raw]
Subject: [tip:perf/urgent] maccess,probe_kernel: Make write/read src const void *

Commit-ID: f29c50419c8d1998edd759f1990c4243a248f469
Gitweb: http://git.kernel.org/tip/f29c50419c8d1998edd759f1990c4243a248f469
Author: Steven Rostedt <[email protected]>
AuthorDate: Thu, 19 May 2011 14:35:33 -0400
Committer: Steven Rostedt <[email protected]>
CommitDate: Wed, 25 May 2011 19:56:23 -0400

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: Mike Frysinger <[email protected]>
Acked-by: Heiko Carstens <[email protected]>
Acked-by: Martin Schwidefsky <[email protected]>
Signed-off-by: Steven Rostedt <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
---
arch/blackfin/mm/maccess.c | 4 ++--
arch/s390/mm/maccess.c | 4 ++--
include/linux/uaccess.h | 8 ++++----
mm/maccess.c | 8 ++++----
4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/blackfin/mm/maccess.c b/arch/blackfin/mm/maccess.c
index b71cebc..e253211 100644
--- a/arch/blackfin/mm/maccess.c
+++ b/arch/blackfin/mm/maccess.c
@@ -16,7 +16,7 @@ static int validate_memory_access_address(unsigned long addr, int 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;
int mem_type;
@@ -55,7 +55,7 @@ long probe_kernel_read(void *dst, void *src, size_t size)
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;
int mem_type;
diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c
index 71a4b0d..51e5cd9 100644
--- a/arch/s390/mm/maccess.c
+++ b/arch/s390/mm/maccess.c
@@ -19,7 +19,7 @@
* using the stura instruction.
* 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;
int offset, mask;
@@ -45,7 +45,7 @@ static long probe_kernel_write_odd(void *dst, void *src, size_t size)
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;

diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index d512d98..5ca0951 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -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
* 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, 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, const void *src, size_t size);

/*
* 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);
* Safely write to address @dst from the buffer at @src. If a kernel fault
* 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, 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, const void *src, size_t size);

#endif /* __LINUX_UACCESS_H__ */
diff --git a/mm/maccess.c b/mm/maccess.c
index e2b6f56..4cee182 100644
--- a/mm/maccess.c
+++ b/mm/maccess.c
@@ -15,10 +15,10 @@
* 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")));

-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;
mm_segment_t old_fs = get_fs();
@@ -43,10 +43,10 @@ EXPORT_SYMBOL_GPL(probe_kernel_read);
* Safely write to address @dst from the buffer at @src. If a kernel fault
* 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")));

-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;
mm_segment_t old_fs = get_fs();