2022-08-22 09:01:37

by Jens Wiklander

[permalink] [raw]
Subject: [PATCH] tee: fix compiler warning in tee_shm_register()

Include <linux/uaccess.h> to avoid the warning:
drivers/tee/tee_shm.c: In function 'tee_shm_register':
>> drivers/tee/tee_shm.c:242:14: error: implicit declaration of function 'access_ok' [-Werror=implicit-function-declaration]
242 | if (!access_ok((void __user *)addr, length))
| ^~~~~~~~~
cc1: some warnings being treated as errors

Fixes: 573ae4f13f63 ("tee: add overflow check in register_shm_helper()")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Jens Wiklander <[email protected]>
---
drivers/tee/tee_shm.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
index 1175f3a46859..27295bda3e0b 100644
--- a/drivers/tee/tee_shm.c
+++ b/drivers/tee/tee_shm.c
@@ -9,6 +9,7 @@
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/tee_drv.h>
+#include <linux/uaccess.h>
#include <linux/uio.h>
#include "tee_private.h"

--
2.31.1


2022-08-22 09:36:33

by Sumit Garg

[permalink] [raw]
Subject: Re: [PATCH] tee: fix compiler warning in tee_shm_register()

On Mon, 22 Aug 2022 at 13:58, Jens Wiklander <[email protected]> wrote:
>
> Include <linux/uaccess.h> to avoid the warning:
> drivers/tee/tee_shm.c: In function 'tee_shm_register':
> >> drivers/tee/tee_shm.c:242:14: error: implicit declaration of function 'access_ok' [-Werror=implicit-function-declaration]
> 242 | if (!access_ok((void __user *)addr, length))
> | ^~~~~~~~~
> cc1: some warnings being treated as errors
>
> Fixes: 573ae4f13f63 ("tee: add overflow check in register_shm_helper()")
> Reported-by: kernel test robot <[email protected]>
> Signed-off-by: Jens Wiklander <[email protected]>
> ---
> drivers/tee/tee_shm.c | 1 +
> 1 file changed, 1 insertion(+)
>

Reviewed-by: Sumit Garg <[email protected]>

-Sumit

> diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
> index 1175f3a46859..27295bda3e0b 100644
> --- a/drivers/tee/tee_shm.c
> +++ b/drivers/tee/tee_shm.c
> @@ -9,6 +9,7 @@
> #include <linux/sched.h>
> #include <linux/slab.h>
> #include <linux/tee_drv.h>
> +#include <linux/uaccess.h>
> #include <linux/uio.h>
> #include "tee_private.h"
>
> --
> 2.31.1
>

2022-08-25 08:47:53

by Jens Wiklander

[permalink] [raw]
Subject: Re: [PATCH] tee: fix compiler warning in tee_shm_register()

On Mon, Aug 22, 2022 at 10:39 AM Sumit Garg <[email protected]> wrote:
>
> On Mon, 22 Aug 2022 at 13:58, Jens Wiklander <[email protected]> wrote:
> >
> > Include <linux/uaccess.h> to avoid the warning:
> > drivers/tee/tee_shm.c: In function 'tee_shm_register':
> > >> drivers/tee/tee_shm.c:242:14: error: implicit declaration of function 'access_ok' [-Werror=implicit-function-declaration]
> > 242 | if (!access_ok((void __user *)addr, length))
> > | ^~~~~~~~~
> > cc1: some warnings being treated as errors
> >
> > Fixes: 573ae4f13f63 ("tee: add overflow check in register_shm_helper()")
> > Reported-by: kernel test robot <[email protected]>
> > Signed-off-by: Jens Wiklander <[email protected]>
> > ---
> > drivers/tee/tee_shm.c | 1 +
> > 1 file changed, 1 insertion(+)
> >
>
> Reviewed-by: Sumit Garg <[email protected]>

Thanks, I'm picking this up now.

Cheers,
Jens

>
> -Sumit
>
> > diff --git a/drivers/tee/tee_shm.c b/drivers/tee/tee_shm.c
> > index 1175f3a46859..27295bda3e0b 100644
> > --- a/drivers/tee/tee_shm.c
> > +++ b/drivers/tee/tee_shm.c
> > @@ -9,6 +9,7 @@
> > #include <linux/sched.h>
> > #include <linux/slab.h>
> > #include <linux/tee_drv.h>
> > +#include <linux/uaccess.h>
> > #include <linux/uio.h>
> > #include "tee_private.h"
> >
> > --
> > 2.31.1
> >