Re: [for-linus][PATCH 01/10] tracing: Suppress sparse warnings triggered by is_signed_type()

From: Bart Van Assche
Date: Wed Aug 24 2022 - 19:28:34 EST


On 8/23/22 18:49, Linus Torvalds wrote:
On Tue, Aug 23, 2022 at 5:09 PM Bart Van Assche <bvanassche@xxxxxxx> wrote:

I'm probably doing something wrong but even with sparse commit 658ee8e0f631
("unrestricted values are unrestricted even after a cast") I see warnings
being triggered by users of the is_signed_type() macro, warnings that
disappear if I change the definition of the is_signed_type() macro into 0:

That's the

It does require that kernel change to make

#define is_signed_type(type) (((type)(-1)) <= (type)0)

part I was talking about.

So your kernel side patch looks fine, except I don't think you need
the '__force' - the sparse patches in my tree should make sparse happy
about casting '-1'.

But I didn't do very much testing.

Hi Linus,

Can you take a look at the following report from the kernel test robot:
https://lore.kernel.org/all/202208250433.EVz5pZkB-lkp@xxxxxxxxx/ ?

Do I see correctly that gcc reports a new warning for the above definition of is_signed_type() with W=1? I'm not sure how to get rid of that new gcc warning without reintroducing a sparse warning.

The tree that the kernel robot tested is available here: https://github.com/bvanassche/linux/tree/tracing

Thanks,

Bart.