Re: drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c:1056 vchiq_get_user_ptr() error: uninitialized symbol 'ptr'.

From: Arnd Bergmann
Date: Tue Jan 05 2021 - 08:54:20 EST


On Mon, Jan 4, 2021 at 11:54 AM Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:

>
> 5d240a54be7e592 Arnd Bergmann 2020-09-18 1044 static inline int vchiq_get_user_ptr(void __user **buf, void __user *ubuf, int index)
> 5d240a54be7e592 Arnd Bergmann 2020-09-18 1045 {
> 5d240a54be7e592 Arnd Bergmann 2020-09-18 1046 int ret;
> 5d240a54be7e592 Arnd Bergmann 2020-09-18 1047
> 5d240a54be7e592 Arnd Bergmann 2020-09-18 1048 if (in_compat_syscall()) {
> 4184da4f316a549 Arnd Bergmann 2020-09-25 1049 compat_uptr_t ptr32;
> 5d240a54be7e592 Arnd Bergmann 2020-09-18 1050 compat_uptr_t __user *uptr = ubuf;
> 4184da4f316a549 Arnd Bergmann 2020-09-25 1051 ret = get_user(ptr32, uptr + index);
> 5d240a54be7e592 Arnd Bergmann 2020-09-18 1052 *buf = compat_ptr(ptr32);
> 5d240a54be7e592 Arnd Bergmann 2020-09-18 1053 } else {
> 4184da4f316a549 Arnd Bergmann 2020-09-25 1054 uintptr_t ptr, __user *uptr = ubuf;
> 4184da4f316a549 Arnd Bergmann 2020-09-25 1055 ret = get_user(ptr, uptr + index);
> 4184da4f316a549 Arnd Bergmann 2020-09-25 @1056 *buf = (void __user *)ptr;
>
> If get_user() fails then this is uninitialized. This will trigger a
> runtime error if the UBSan uninitialized behavior tool is enabled.

Thanks for the report, I sent a fix now.

Arnd