All of lore.kernel.org
 help / color / mirror / Atom feed
* sparse: Lots of (erroneous?) "different address space" errrors in new version
@ 2025-11-24  8:55 Ricardo Ribalda
  2025-12-01  7:31 ` Ricardo Ribalda
  2025-12-01  8:27 ` Dan Carpenter
  0 siblings, 2 replies; 4+ messages in thread
From: Ricardo Ribalda @ 2025-11-24  8:55 UTC (permalink / raw)
  To: Dan Carpenter, Uros Bizjak; +Cc: Linux Media Mailing List, Hans Verkuil

Hi Dan

Every week we bump the smatch/sparse version used by Linux-media's CI.

We were almost error free, but the last version has introduced a huge
amount of errors:
https://linux-media.pages.freedesktop.org/-/users/ci/-/jobs/88441453/artifacts/junit/test-sparse.log.txt

(It is also reproducible with linus/master)


I have bisected your tool and it seems like they were introduced by:
commit e53027a4e816a772403baafa83c09e4a94c1cb8f (HEAD)
Author: Dan Carpenter <dan.carpenter@linaro.org>
Date:   Sat Oct 18 12:31:01 2025 +0300

    symbol: preserver address space qualifiers with typeof()

    When we're parsing typeof(var) we should preserve the address space
    qualifiers as well.

    Reported-by: Uros Bizjak <ubizjak@gmail.com>
    Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>


One example of the new error found is:

make -i W=1 C=1 CHECK="sparse" CF="-D__CHECK_ENDIAN__
-fmemcpy-max-count=11000000" KCFLAGS="-Wmaybe-uninitialized"
drivers/media/v4l2-core/v4l2-compat-ioctl32.o
drivers/media/v4l2-core/v4l2-compat-ioctl32.c:763:13: warning:
incorrect type in argument 2 (different address spaces)
09:08 drivers/media/v4l2-core/v4l2-compat-ioctl32.c:763:13: expected
void const *from
09:08 drivers/media/v4l2-core/v4l2-compat-ioctl32.c:763:13: got
unsigned int __user *


static int put_v4l2_event32_time32(struct v4l2_event *p64,
                                   struct v4l2_event32_time32 __user *p32)
{
        if (put_user(p64->type, &p32->type)


Seems like if we would like to fix the error, put_user should be modified....

Maybe it would be better to revert `symbol: preserver address space
qualifiers with typeof()` until the codebase is ready for it?

Regards

-- 
Ricardo Ribalda

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

* Re: sparse: Lots of (erroneous?) "different address space" errrors in new version
  2025-11-24  8:55 sparse: Lots of (erroneous?) "different address space" errrors in new version Ricardo Ribalda
@ 2025-12-01  7:31 ` Ricardo Ribalda
  2025-12-01  8:27 ` Dan Carpenter
  1 sibling, 0 replies; 4+ messages in thread
From: Ricardo Ribalda @ 2025-12-01  7:31 UTC (permalink / raw)
  To: Dan Carpenter, Uros Bizjak; +Cc: Linux Media Mailing List, Hans Verkuil

Hi Dan

Friendly ping?

Thanks :)

On Mon, 24 Nov 2025 at 09:55, Ricardo Ribalda <ribalda@chromium.org> wrote:
>
> Hi Dan
>
> Every week we bump the smatch/sparse version used by Linux-media's CI.
>
> We were almost error free, but the last version has introduced a huge
> amount of errors:
> https://linux-media.pages.freedesktop.org/-/users/ci/-/jobs/88441453/artifacts/junit/test-sparse.log.txt
>
> (It is also reproducible with linus/master)
>
>
> I have bisected your tool and it seems like they were introduced by:
> commit e53027a4e816a772403baafa83c09e4a94c1cb8f (HEAD)
> Author: Dan Carpenter <dan.carpenter@linaro.org>
> Date:   Sat Oct 18 12:31:01 2025 +0300
>
>     symbol: preserver address space qualifiers with typeof()
>
>     When we're parsing typeof(var) we should preserve the address space
>     qualifiers as well.
>
>     Reported-by: Uros Bizjak <ubizjak@gmail.com>
>     Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
>
>
> One example of the new error found is:
>
> make -i W=1 C=1 CHECK="sparse" CF="-D__CHECK_ENDIAN__
> -fmemcpy-max-count=11000000" KCFLAGS="-Wmaybe-uninitialized"
> drivers/media/v4l2-core/v4l2-compat-ioctl32.o
> drivers/media/v4l2-core/v4l2-compat-ioctl32.c:763:13: warning:
> incorrect type in argument 2 (different address spaces)
> 09:08 drivers/media/v4l2-core/v4l2-compat-ioctl32.c:763:13: expected
> void const *from
> 09:08 drivers/media/v4l2-core/v4l2-compat-ioctl32.c:763:13: got
> unsigned int __user *
>
>
> static int put_v4l2_event32_time32(struct v4l2_event *p64,
>                                    struct v4l2_event32_time32 __user *p32)
> {
>         if (put_user(p64->type, &p32->type)
>
>
> Seems like if we would like to fix the error, put_user should be modified....
>
> Maybe it would be better to revert `symbol: preserver address space
> qualifiers with typeof()` until the codebase is ready for it?
>
> Regards
>
> --
> Ricardo Ribalda



-- 
Ricardo Ribalda

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

* Re: sparse: Lots of (erroneous?) "different address space" errrors in new version
  2025-11-24  8:55 sparse: Lots of (erroneous?) "different address space" errrors in new version Ricardo Ribalda
  2025-12-01  7:31 ` Ricardo Ribalda
@ 2025-12-01  8:27 ` Dan Carpenter
  2025-12-01 14:57   ` Ricardo Ribalda
  1 sibling, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2025-12-01  8:27 UTC (permalink / raw)
  To: Ricardo Ribalda; +Cc: Uros Bizjak, Linux Media Mailing List, Hans Verkuil

On Mon, Nov 24, 2025 at 09:55:18AM +0100, Ricardo Ribalda wrote:
> Hi Dan
> 
> Every week we bump the smatch/sparse version used by Linux-media's CI.
> 
> We were almost error free, but the last version has introduced a huge
> amount of errors:
> https://linux-media.pages.freedesktop.org/-/users/ci/-/jobs/88441453/artifacts/junit/test-sparse.log.txt
> 
> (It is also reproducible with linus/master)
> 
> 
> I have bisected your tool and it seems like they were introduced by:
> commit e53027a4e816a772403baafa83c09e4a94c1cb8f (HEAD)
> Author: Dan Carpenter <dan.carpenter@linaro.org>
> Date:   Sat Oct 18 12:31:01 2025 +0300
> 
>     symbol: preserver address space qualifiers with typeof()
> 
>     When we're parsing typeof(var) we should preserve the address space
>     qualifiers as well.
> 
>     Reported-by: Uros Bizjak <ubizjak@gmail.com>
>     Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> 
> 
> One example of the new error found is:
> 
> make -i W=1 C=1 CHECK="sparse" CF="-D__CHECK_ENDIAN__
> -fmemcpy-max-count=11000000" KCFLAGS="-Wmaybe-uninitialized"
> drivers/media/v4l2-core/v4l2-compat-ioctl32.o
> drivers/media/v4l2-core/v4l2-compat-ioctl32.c:763:13: warning:
> incorrect type in argument 2 (different address spaces)
> 09:08 drivers/media/v4l2-core/v4l2-compat-ioctl32.c:763:13: expected
> void const *from
> 09:08 drivers/media/v4l2-core/v4l2-compat-ioctl32.c:763:13: got
> unsigned int __user *
> 
> 
> static int put_v4l2_event32_time32(struct v4l2_event *p64,
>                                    struct v4l2_event32_time32 __user *p32)
> {
>         if (put_user(p64->type, &p32->type)
> 
> 
> Seems like if we would like to fix the error, put_user should be modified....
> 
> Maybe it would be better to revert `symbol: preserver address space
> qualifiers with typeof()` until the codebase is ready for it?

Huh.  Sorry, I don't know how I missed your email last week.

The do_put_user_call() is doing this:

	__typeof__(*(ptr)) __x = (x); /* eval x once */

And ptr is the __user pointer so Sparse is doing the correct thing.
We could change the __typeof__ to __typeof_unqual__.  It silences the
warning.  I'll rebuild the entire kernel to see if it causes any other
issues...

regards,
dan carpenter

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

* Re: sparse: Lots of (erroneous?) "different address space" errrors in new version
  2025-12-01  8:27 ` Dan Carpenter
@ 2025-12-01 14:57   ` Ricardo Ribalda
  0 siblings, 0 replies; 4+ messages in thread
From: Ricardo Ribalda @ 2025-12-01 14:57 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Uros Bizjak, Linux Media Mailing List, Hans Verkuil

Hi Dan

Thanks for the response.

On Mon, 1 Dec 2025 at 09:28, Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> On Mon, Nov 24, 2025 at 09:55:18AM +0100, Ricardo Ribalda wrote:
> > Hi Dan
> >
> > Every week we bump the smatch/sparse version used by Linux-media's CI.
> >
> > We were almost error free, but the last version has introduced a huge
> > amount of errors:
> > https://linux-media.pages.freedesktop.org/-/users/ci/-/jobs/88441453/artifacts/junit/test-sparse.log.txt
> >
> > (It is also reproducible with linus/master)
> >
> >
> > I have bisected your tool and it seems like they were introduced by:
> > commit e53027a4e816a772403baafa83c09e4a94c1cb8f (HEAD)
> > Author: Dan Carpenter <dan.carpenter@linaro.org>
> > Date:   Sat Oct 18 12:31:01 2025 +0300
> >
> >     symbol: preserver address space qualifiers with typeof()
> >
> >     When we're parsing typeof(var) we should preserve the address space
> >     qualifiers as well.
> >
> >     Reported-by: Uros Bizjak <ubizjak@gmail.com>
> >     Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> >
> >
> > One example of the new error found is:
> >
> > make -i W=1 C=1 CHECK="sparse" CF="-D__CHECK_ENDIAN__
> > -fmemcpy-max-count=11000000" KCFLAGS="-Wmaybe-uninitialized"
> > drivers/media/v4l2-core/v4l2-compat-ioctl32.o
> > drivers/media/v4l2-core/v4l2-compat-ioctl32.c:763:13: warning:
> > incorrect type in argument 2 (different address spaces)
> > 09:08 drivers/media/v4l2-core/v4l2-compat-ioctl32.c:763:13: expected
> > void const *from
> > 09:08 drivers/media/v4l2-core/v4l2-compat-ioctl32.c:763:13: got
> > unsigned int __user *
> >
> >
> > static int put_v4l2_event32_time32(struct v4l2_event *p64,
> >                                    struct v4l2_event32_time32 __user *p32)
> > {
> >         if (put_user(p64->type, &p32->type)
> >
> >
> > Seems like if we would like to fix the error, put_user should be modified....
> >
> > Maybe it would be better to revert `symbol: preserver address space
> > qualifiers with typeof()` until the codebase is ready for it?
>
> Huh.  Sorry, I don't know how I missed your email last week.
>
> The do_put_user_call() is doing this:
>
>         __typeof__(*(ptr)) __x = (x); /* eval x once */
>
> And ptr is the __user pointer so Sparse is doing the correct thing.
> We could change the __typeof__ to __typeof_unqual__.  It silences the
> warning.  I'll rebuild the entire kernel to see if it causes any other
> issues...

Just FYI, after patching do_put_user_call.

We still have issues with lockdep_assert_irqs_enabled(),
lockdep_assert_in_irq() and TRACE_EVENT()


Regards!


>
> regards,
> dan carpenter



-- 
Ricardo Ribalda

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

end of thread, other threads:[~2025-12-01 14:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-24  8:55 sparse: Lots of (erroneous?) "different address space" errrors in new version Ricardo Ribalda
2025-12-01  7:31 ` Ricardo Ribalda
2025-12-01  8:27 ` Dan Carpenter
2025-12-01 14:57   ` Ricardo Ribalda

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.