On 06/07/2023 23:16, Menna Mahmoud wrote:
got this error when enabling 'CONFIG_TEE' and 'CONFIG_OPTEE':
/home/morello/workspace/linux/drivers/tee/tee_core.c:851:20: error: incompatible function pointer types initializing 'long (*)(struct file *, unsigned int, user_uintptr_t)' (aka 'long (*)(struct file *, unsigned int, unsigned __intcap)') with an expression of type 'long (struct file *, unsigned int, unsigned long)' [-Werror,-Wincompatible-function-pointer-types] .unlocked_ioctl = tee_ioctl, ^~~~~~~~~ 1 error generated. make[4]: *** [/home/morello/workspace/linux/scripts/Makefile.build:250: drivers/tee/tee_core.o] Error 1 make[3]: *** [/home/morello/workspace/linux/scripts/Makefile.build:500: drivers/tee] Error 2 make[2]: *** [/home/morello/workspace/linux/scripts/Makefile.build:500: drivers] Error 2 make[1]: *** [/home/morello/workspace/linux/Makefile:1999: .] Error 2 make[1]: Leaving directory '/home/morello/workspace/linux-out' make: *** [Makefile:231: __sub-make] Error 2
Hi Menna,
Thanks for this patch! The diff looks right to me, the native and compat ioctl handlers already handle pointers correctly so we just need to change this prototype. Just a few comments on the commit message: - Make sure to start sentences with capital letters. - There is no need to include the full error message, as it is an expected issue when building a new driver in PCuABI, see [1]. Pawel recently fixed one of those in another driver [2], his commit message can provide some inspiration.
More importantly, did you have the chance to test OP-TEE? If so, it would be nice to add the corresponding options to the Morello defconfig, in a follow-up patch, as they already are in the standard arm64 defconfig. Pawel's patch from the same series [3] is a good example of how to do this (make sure to use `make savedefconfig` to generate a minimal defconfig file).
Cheers, Kevin
[1] https://git.morello-project.org/morello/kernel/linux/-/blob/morello/master/D... [2] https://op-lists.linaro.org/archives/list/linux-morello@op-lists.linaro.org/... [3] https://op-lists.linaro.org/archives/list/linux-morello@op-lists.linaro.org/...
fix it by changing type 'unsigned long' to 'user_uintptr_t'.
Signed-off-by: Menna Mahmoud eng.mennamahmoud.mm@gmail.com
drivers/tee/tee_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c index 98da206cd761..780a094f16ac 100644 --- a/drivers/tee/tee_core.c +++ b/drivers/tee/tee_core.c @@ -815,7 +815,7 @@ static int tee_ioctl_supp_send(struct tee_context *ctx, return rc; } -static long tee_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) +static long tee_ioctl(struct file *filp, unsigned int cmd, user_uintptr_t arg) { struct tee_context *ctx = filp->private_data; void __user *uarg = (void __user *)arg;