All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/uaccess: fix warning/error with access_ok()
@ 2018-10-18  8:48 ` Christophe Leroy
  0 siblings, 0 replies; 5+ messages in thread
From: Christophe Leroy @ 2018-10-18  8:48 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linux-kernel, linuxppc-dev

With the following peace of code, the following compilation warning
is encountered:

	if (_IOC_DIR(ioc) != _IOC_NONE) {
		int verify = _IOC_DIR(ioc) & _IOC_READ ? VERIFY_WRITE : VERIFY_READ;

		if (!access_ok(verify, ioarg, _IOC_SIZE(ioc))) {

drivers/platform/test/dev.c: In function ‘my_ioctl’:
drivers/platform/test/dev.c:219:7: warning: unused variable ‘verify’ [-Wunused-variable]
   int verify = _IOC_DIR(ioc) & _IOC_READ ? VERIFY_WRITE : VERIFY_READ;

This patch fixes it by handing the type to __access_ok(), changing it
to an inline function for PPC64 as already done for PPC32

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/include/asm/uaccess.h | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
index 15bea9a0f260..97faf0353919 100644
--- a/arch/powerpc/include/asm/uaccess.h
+++ b/arch/powerpc/include/asm/uaccess.h
@@ -47,13 +47,16 @@ static inline void set_fs(mm_segment_t fs)
  * This check is sufficient because there is a large enough
  * gap between user addresses and the kernel addresses
  */
-#define __access_ok(addr, size, segment)	\
-	(((addr) <= (segment).seg) && ((size) <= (segment).seg))
+static inline int __access_ok(int type, unsigned long addr, unsigned long size,
+			      mm_segment_t seg)
+{
+	return addr <= seg.seg && size <= seg.seg;
+}
 
 #else
 
-static inline int __access_ok(unsigned long addr, unsigned long size,
-			mm_segment_t seg)
+static inline int __access_ok(int type, unsigned long addr, unsigned long size,
+			      mm_segment_t seg)
 {
 	if (addr > seg.seg)
 		return 0;
@@ -64,7 +67,7 @@ static inline int __access_ok(unsigned long addr, unsigned long size,
 
 #define access_ok(type, addr, size)		\
 	(__chk_user_ptr(addr),			\
-	 __access_ok((__force unsigned long)(addr), (size), get_fs()))
+	 __access_ok((type), (__force unsigned long)(addr), (size), get_fs()))
 
 /*
  * These are the main single-value transfer routines.  They automatically
-- 
2.13.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] powerpc/uaccess: fix warning/error with access_ok()
@ 2018-10-18  8:48 ` Christophe Leroy
  0 siblings, 0 replies; 5+ messages in thread
From: Christophe Leroy @ 2018-10-18  8:48 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linuxppc-dev, linux-kernel

With the following peace of code, the following compilation warning
is encountered:

	if (_IOC_DIR(ioc) != _IOC_NONE) {
		int verify = _IOC_DIR(ioc) & _IOC_READ ? VERIFY_WRITE : VERIFY_READ;

		if (!access_ok(verify, ioarg, _IOC_SIZE(ioc))) {

drivers/platform/test/dev.c: In function ‘my_ioctl’:
drivers/platform/test/dev.c:219:7: warning: unused variable ‘verify’ [-Wunused-variable]
   int verify = _IOC_DIR(ioc) & _IOC_READ ? VERIFY_WRITE : VERIFY_READ;

This patch fixes it by handing the type to __access_ok(), changing it
to an inline function for PPC64 as already done for PPC32

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 arch/powerpc/include/asm/uaccess.h | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
index 15bea9a0f260..97faf0353919 100644
--- a/arch/powerpc/include/asm/uaccess.h
+++ b/arch/powerpc/include/asm/uaccess.h
@@ -47,13 +47,16 @@ static inline void set_fs(mm_segment_t fs)
  * This check is sufficient because there is a large enough
  * gap between user addresses and the kernel addresses
  */
-#define __access_ok(addr, size, segment)	\
-	(((addr) <= (segment).seg) && ((size) <= (segment).seg))
+static inline int __access_ok(int type, unsigned long addr, unsigned long size,
+			      mm_segment_t seg)
+{
+	return addr <= seg.seg && size <= seg.seg;
+}
 
 #else
 
-static inline int __access_ok(unsigned long addr, unsigned long size,
-			mm_segment_t seg)
+static inline int __access_ok(int type, unsigned long addr, unsigned long size,
+			      mm_segment_t seg)
 {
 	if (addr > seg.seg)
 		return 0;
@@ -64,7 +67,7 @@ static inline int __access_ok(unsigned long addr, unsigned long size,
 
 #define access_ok(type, addr, size)		\
 	(__chk_user_ptr(addr),			\
-	 __access_ok((__force unsigned long)(addr), (size), get_fs()))
+	 __access_ok((type), (__force unsigned long)(addr), (size), get_fs()))
 
 /*
  * These are the main single-value transfer routines.  They automatically
-- 
2.13.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc/uaccess: fix warning/error with access_ok()
  2018-10-18  8:48 ` Christophe Leroy
  (?)
@ 2018-10-18  9:19 ` Christophe LEROY
  -1 siblings, 0 replies; 5+ messages in thread
From: Christophe LEROY @ 2018-10-18  9:19 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linuxppc-dev, linux-kernel



Le 18/10/2018 à 10:48, Christophe Leroy a écrit :
> With the following peace of code, the following compilation warning
> is encountered:
> 
> 	if (_IOC_DIR(ioc) != _IOC_NONE) {
> 		int verify = _IOC_DIR(ioc) & _IOC_READ ? VERIFY_WRITE : VERIFY_READ;
> 
> 		if (!access_ok(verify, ioarg, _IOC_SIZE(ioc))) {
> 
> drivers/platform/test/dev.c: In function ‘my_ioctl’:
> drivers/platform/test/dev.c:219:7: warning: unused variable ‘verify’ [-Wunused-variable]
>     int verify = _IOC_DIR(ioc) & _IOC_READ ? VERIFY_WRITE : VERIFY_READ;
> 
> This patch fixes it by handing the type to __access_ok(), changing it
> to an inline function for PPC64 as already done for PPC32

Oops, not that easy, there are places using __access_ok() directly, 
those need to be modified as well.

Christophe

> 
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> ---
>   arch/powerpc/include/asm/uaccess.h | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
> index 15bea9a0f260..97faf0353919 100644
> --- a/arch/powerpc/include/asm/uaccess.h
> +++ b/arch/powerpc/include/asm/uaccess.h
> @@ -47,13 +47,16 @@ static inline void set_fs(mm_segment_t fs)
>    * This check is sufficient because there is a large enough
>    * gap between user addresses and the kernel addresses
>    */
> -#define __access_ok(addr, size, segment)	\
> -	(((addr) <= (segment).seg) && ((size) <= (segment).seg))
> +static inline int __access_ok(int type, unsigned long addr, unsigned long size,
> +			      mm_segment_t seg)
> +{
> +	return addr <= seg.seg && size <= seg.seg;
> +}
>   
>   #else
>   
> -static inline int __access_ok(unsigned long addr, unsigned long size,
> -			mm_segment_t seg)
> +static inline int __access_ok(int type, unsigned long addr, unsigned long size,
> +			      mm_segment_t seg)
>   {
>   	if (addr > seg.seg)
>   		return 0;
> @@ -64,7 +67,7 @@ static inline int __access_ok(unsigned long addr, unsigned long size,
>   
>   #define access_ok(type, addr, size)		\
>   	(__chk_user_ptr(addr),			\
> -	 __access_ok((__force unsigned long)(addr), (size), get_fs()))
> +	 __access_ok((type), (__force unsigned long)(addr), (size), get_fs()))
>   
>   /*
>    * These are the main single-value transfer routines.  They automatically
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc/uaccess: fix warning/error with access_ok()
  2018-10-18  8:48 ` Christophe Leroy
@ 2018-10-18 23:11   ` kbuild test robot
  -1 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2018-10-18 23:11 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: kbuild-all, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, linux-kernel, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 8785 bytes --]

Hi Christophe,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.19-rc8 next-20181018]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Christophe-Leroy/powerpc-uaccess-fix-warning-error-with-access_ok/20181019-031908
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-socrates_defconfig (attached as .config)
compiler: powerpc-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=powerpc 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/uaccess.h:14:0,
                    from arch/powerpc/include/asm/sections.h:7,
                    from include/linux/kallsyms.h:15,
                    from include/linux/ftrace.h:11,
                    from include/linux/init_task.h:9,
                    from arch/powerpc/kernel/process.c:32:
   arch/powerpc/kernel/process.c: In function 'show_user_instructions':
>> arch/powerpc/include/asm/uaccess.h:21:25: error: incompatible type for argument 3 of '__access_ok'
    #define MAKE_MM_SEG(s)  ((mm_segment_t) { (s) })
                            ^
>> arch/powerpc/include/asm/uaccess.h:28:18: note: in expansion of macro 'MAKE_MM_SEG'
    #define USER_DS  MAKE_MM_SEG(TASK_SIZE - 1)
                     ^~~~~~~~~~~
>> arch/powerpc/kernel/process.c:1313:55: note: in expansion of macro 'USER_DS'
     if (!__access_ok(pc, NR_INSN_TO_PRINT * sizeof(int), USER_DS)) {
                                                          ^~~~~~~
   arch/powerpc/include/asm/uaccess.h:58:19: note: expected 'long unsigned int' but argument is of type 'mm_segment_t {aka struct <anonymous>}'
    static inline int __access_ok(int type, unsigned long addr, unsigned long size,
                      ^~~~~~~~~~~
>> arch/powerpc/kernel/process.c:1313:7: error: too few arguments to function '__access_ok'
     if (!__access_ok(pc, NR_INSN_TO_PRINT * sizeof(int), USER_DS)) {
          ^~~~~~~~~~~
   In file included from include/linux/uaccess.h:14:0,
                    from arch/powerpc/include/asm/sections.h:7,
                    from include/linux/kallsyms.h:15,
                    from include/linux/ftrace.h:11,
                    from include/linux/init_task.h:9,
                    from arch/powerpc/kernel/process.c:32:
   arch/powerpc/include/asm/uaccess.h:58:19: note: declared here
    static inline int __access_ok(int type, unsigned long addr, unsigned long size,
                      ^~~~~~~~~~~
--
   In file included from include/linux/uaccess.h:14:0,
                    from arch/powerpc/include/asm/sections.h:7,
                    from include/linux/kallsyms.h:15,
                    from include/linux/ftrace.h:11,
                    from include/linux/kprobes.h:42,
                    from arch/powerpc/lib/sstep.c:12:
   arch/powerpc/lib/sstep.c: In function 'address_ok':
>> arch/powerpc/include/asm/uaccess.h:21:25: error: incompatible type for argument 3 of '__access_ok'
    #define MAKE_MM_SEG(s)  ((mm_segment_t) { (s) })
                            ^
>> arch/powerpc/include/asm/uaccess.h:28:18: note: in expansion of macro 'MAKE_MM_SEG'
    #define USER_DS  MAKE_MM_SEG(TASK_SIZE - 1)
                     ^~~~~~~~~~~
>> arch/powerpc/lib/sstep.c:113:26: note: in expansion of macro 'USER_DS'
     if (__access_ok(ea, nb, USER_DS))
                             ^~~~~~~
   arch/powerpc/include/asm/uaccess.h:58:19: note: expected 'long unsigned int' but argument is of type 'mm_segment_t {aka struct <anonymous>}'
    static inline int __access_ok(int type, unsigned long addr, unsigned long size,
                      ^~~~~~~~~~~
>> arch/powerpc/lib/sstep.c:113:6: error: too few arguments to function '__access_ok'
     if (__access_ok(ea, nb, USER_DS))
         ^~~~~~~~~~~
   In file included from include/linux/uaccess.h:14:0,
                    from arch/powerpc/include/asm/sections.h:7,
                    from include/linux/kallsyms.h:15,
                    from include/linux/ftrace.h:11,
                    from include/linux/kprobes.h:42,
                    from arch/powerpc/lib/sstep.c:12:
   arch/powerpc/include/asm/uaccess.h:58:19: note: declared here
    static inline int __access_ok(int type, unsigned long addr, unsigned long size,
                      ^~~~~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:21:25: error: incompatible type for argument 3 of '__access_ok'
    #define MAKE_MM_SEG(s)  ((mm_segment_t) { (s) })
                            ^
>> arch/powerpc/include/asm/uaccess.h:28:18: note: in expansion of macro 'MAKE_MM_SEG'
    #define USER_DS  MAKE_MM_SEG(TASK_SIZE - 1)
                     ^~~~~~~~~~~
   arch/powerpc/lib/sstep.c:115:25: note: in expansion of macro 'USER_DS'
     if (__access_ok(ea, 1, USER_DS))
                            ^~~~~~~
   arch/powerpc/include/asm/uaccess.h:58:19: note: expected 'long unsigned int' but argument is of type 'mm_segment_t {aka struct <anonymous>}'
    static inline int __access_ok(int type, unsigned long addr, unsigned long size,
                      ^~~~~~~~~~~
   arch/powerpc/lib/sstep.c:115:6: error: too few arguments to function '__access_ok'
     if (__access_ok(ea, 1, USER_DS))
         ^~~~~~~~~~~
   In file included from include/linux/uaccess.h:14:0,
                    from arch/powerpc/include/asm/sections.h:7,
                    from include/linux/kallsyms.h:15,
                    from include/linux/ftrace.h:11,
                    from include/linux/kprobes.h:42,
                    from arch/powerpc/lib/sstep.c:12:
   arch/powerpc/include/asm/uaccess.h:58:19: note: declared here
    static inline int __access_ok(int type, unsigned long addr, unsigned long size,
                      ^~~~~~~~~~~

vim +/__access_ok +21 arch/powerpc/include/asm/uaccess.h

2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29   9  
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  10  /*
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  11   * The fs value determines whether argument validity checking should be
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  12   * performed or not.  If get_fs() == USER_DS, checking is performed, with
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  13   * get_fs() == KERNEL_DS, checking is bypassed.
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  14   *
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  15   * For historical reasons, these macros are grossly misnamed.
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  16   *
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  17   * The fs/ds values are now the highest legal address in the "segment".
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  18   * This simplifies the checking in the routines below.
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  19   */
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  20  
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 @21  #define MAKE_MM_SEG(s)  ((mm_segment_t) { (s) })
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  22  
5015b494 include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-31  23  #define KERNEL_DS	MAKE_MM_SEG(~0UL)
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  24  #ifdef __powerpc64__
5015b494 include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-31  25  /* We use TASK_SIZE_USER64 as TASK_SIZE is not constant */
5015b494 include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-31  26  #define USER_DS		MAKE_MM_SEG(TASK_SIZE_USER64 - 1)
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  27  #else
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 @28  #define USER_DS		MAKE_MM_SEG(TASK_SIZE - 1)
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  29  #endif
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  30  

:::::: The code at line 21 was first introduced by commit
:::::: 2df5e8bcca53e528a78ee0e3b114d0d21dd6d043 powerpc: merge uaccess.h

:::::: TO: Stephen Rothwell <sfr@canb.auug.org.au>
:::::: CC: Stephen Rothwell <sfr@canb.auug.org.au>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 17535 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] powerpc/uaccess: fix warning/error with access_ok()
@ 2018-10-18 23:11   ` kbuild test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kbuild test robot @ 2018-10-18 23:11 UTC (permalink / raw)
  To: Christophe Leroy; +Cc: linux-kernel, Paul Mackerras, kbuild-all, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 8785 bytes --]

Hi Christophe,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on powerpc/next]
[also build test ERROR on v4.19-rc8 next-20181018]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Christophe-Leroy/powerpc-uaccess-fix-warning-error-with-access_ok/20181019-031908
base:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
config: powerpc-socrates_defconfig (attached as .config)
compiler: powerpc-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=powerpc 

All error/warnings (new ones prefixed by >>):

   In file included from include/linux/uaccess.h:14:0,
                    from arch/powerpc/include/asm/sections.h:7,
                    from include/linux/kallsyms.h:15,
                    from include/linux/ftrace.h:11,
                    from include/linux/init_task.h:9,
                    from arch/powerpc/kernel/process.c:32:
   arch/powerpc/kernel/process.c: In function 'show_user_instructions':
>> arch/powerpc/include/asm/uaccess.h:21:25: error: incompatible type for argument 3 of '__access_ok'
    #define MAKE_MM_SEG(s)  ((mm_segment_t) { (s) })
                            ^
>> arch/powerpc/include/asm/uaccess.h:28:18: note: in expansion of macro 'MAKE_MM_SEG'
    #define USER_DS  MAKE_MM_SEG(TASK_SIZE - 1)
                     ^~~~~~~~~~~
>> arch/powerpc/kernel/process.c:1313:55: note: in expansion of macro 'USER_DS'
     if (!__access_ok(pc, NR_INSN_TO_PRINT * sizeof(int), USER_DS)) {
                                                          ^~~~~~~
   arch/powerpc/include/asm/uaccess.h:58:19: note: expected 'long unsigned int' but argument is of type 'mm_segment_t {aka struct <anonymous>}'
    static inline int __access_ok(int type, unsigned long addr, unsigned long size,
                      ^~~~~~~~~~~
>> arch/powerpc/kernel/process.c:1313:7: error: too few arguments to function '__access_ok'
     if (!__access_ok(pc, NR_INSN_TO_PRINT * sizeof(int), USER_DS)) {
          ^~~~~~~~~~~
   In file included from include/linux/uaccess.h:14:0,
                    from arch/powerpc/include/asm/sections.h:7,
                    from include/linux/kallsyms.h:15,
                    from include/linux/ftrace.h:11,
                    from include/linux/init_task.h:9,
                    from arch/powerpc/kernel/process.c:32:
   arch/powerpc/include/asm/uaccess.h:58:19: note: declared here
    static inline int __access_ok(int type, unsigned long addr, unsigned long size,
                      ^~~~~~~~~~~
--
   In file included from include/linux/uaccess.h:14:0,
                    from arch/powerpc/include/asm/sections.h:7,
                    from include/linux/kallsyms.h:15,
                    from include/linux/ftrace.h:11,
                    from include/linux/kprobes.h:42,
                    from arch/powerpc/lib/sstep.c:12:
   arch/powerpc/lib/sstep.c: In function 'address_ok':
>> arch/powerpc/include/asm/uaccess.h:21:25: error: incompatible type for argument 3 of '__access_ok'
    #define MAKE_MM_SEG(s)  ((mm_segment_t) { (s) })
                            ^
>> arch/powerpc/include/asm/uaccess.h:28:18: note: in expansion of macro 'MAKE_MM_SEG'
    #define USER_DS  MAKE_MM_SEG(TASK_SIZE - 1)
                     ^~~~~~~~~~~
>> arch/powerpc/lib/sstep.c:113:26: note: in expansion of macro 'USER_DS'
     if (__access_ok(ea, nb, USER_DS))
                             ^~~~~~~
   arch/powerpc/include/asm/uaccess.h:58:19: note: expected 'long unsigned int' but argument is of type 'mm_segment_t {aka struct <anonymous>}'
    static inline int __access_ok(int type, unsigned long addr, unsigned long size,
                      ^~~~~~~~~~~
>> arch/powerpc/lib/sstep.c:113:6: error: too few arguments to function '__access_ok'
     if (__access_ok(ea, nb, USER_DS))
         ^~~~~~~~~~~
   In file included from include/linux/uaccess.h:14:0,
                    from arch/powerpc/include/asm/sections.h:7,
                    from include/linux/kallsyms.h:15,
                    from include/linux/ftrace.h:11,
                    from include/linux/kprobes.h:42,
                    from arch/powerpc/lib/sstep.c:12:
   arch/powerpc/include/asm/uaccess.h:58:19: note: declared here
    static inline int __access_ok(int type, unsigned long addr, unsigned long size,
                      ^~~~~~~~~~~
>> arch/powerpc/include/asm/uaccess.h:21:25: error: incompatible type for argument 3 of '__access_ok'
    #define MAKE_MM_SEG(s)  ((mm_segment_t) { (s) })
                            ^
>> arch/powerpc/include/asm/uaccess.h:28:18: note: in expansion of macro 'MAKE_MM_SEG'
    #define USER_DS  MAKE_MM_SEG(TASK_SIZE - 1)
                     ^~~~~~~~~~~
   arch/powerpc/lib/sstep.c:115:25: note: in expansion of macro 'USER_DS'
     if (__access_ok(ea, 1, USER_DS))
                            ^~~~~~~
   arch/powerpc/include/asm/uaccess.h:58:19: note: expected 'long unsigned int' but argument is of type 'mm_segment_t {aka struct <anonymous>}'
    static inline int __access_ok(int type, unsigned long addr, unsigned long size,
                      ^~~~~~~~~~~
   arch/powerpc/lib/sstep.c:115:6: error: too few arguments to function '__access_ok'
     if (__access_ok(ea, 1, USER_DS))
         ^~~~~~~~~~~
   In file included from include/linux/uaccess.h:14:0,
                    from arch/powerpc/include/asm/sections.h:7,
                    from include/linux/kallsyms.h:15,
                    from include/linux/ftrace.h:11,
                    from include/linux/kprobes.h:42,
                    from arch/powerpc/lib/sstep.c:12:
   arch/powerpc/include/asm/uaccess.h:58:19: note: declared here
    static inline int __access_ok(int type, unsigned long addr, unsigned long size,
                      ^~~~~~~~~~~

vim +/__access_ok +21 arch/powerpc/include/asm/uaccess.h

2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29   9  
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  10  /*
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  11   * The fs value determines whether argument validity checking should be
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  12   * performed or not.  If get_fs() == USER_DS, checking is performed, with
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  13   * get_fs() == KERNEL_DS, checking is bypassed.
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  14   *
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  15   * For historical reasons, these macros are grossly misnamed.
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  16   *
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  17   * The fs/ds values are now the highest legal address in the "segment".
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  18   * This simplifies the checking in the routines below.
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  19   */
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  20  
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 @21  #define MAKE_MM_SEG(s)  ((mm_segment_t) { (s) })
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  22  
5015b494 include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-31  23  #define KERNEL_DS	MAKE_MM_SEG(~0UL)
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  24  #ifdef __powerpc64__
5015b494 include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-31  25  /* We use TASK_SIZE_USER64 as TASK_SIZE is not constant */
5015b494 include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-31  26  #define USER_DS		MAKE_MM_SEG(TASK_SIZE_USER64 - 1)
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  27  #else
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29 @28  #define USER_DS		MAKE_MM_SEG(TASK_SIZE - 1)
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  29  #endif
2df5e8bc include/asm-powerpc/uaccess.h Stephen Rothwell 2005-10-29  30  

:::::: The code at line 21 was first introduced by commit
:::::: 2df5e8bcca53e528a78ee0e3b114d0d21dd6d043 powerpc: merge uaccess.h

:::::: TO: Stephen Rothwell <sfr@canb.auug.org.au>
:::::: CC: Stephen Rothwell <sfr@canb.auug.org.au>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 17535 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-10-18 23:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-18  8:48 [PATCH] powerpc/uaccess: fix warning/error with access_ok() Christophe Leroy
2018-10-18  8:48 ` Christophe Leroy
2018-10-18  9:19 ` Christophe LEROY
2018-10-18 23:11 ` kbuild test robot
2018-10-18 23:11   ` kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.