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

From: Linus Torvalds
Date: Tue Aug 23 2022 - 22:16:38 EST


On Tue, Aug 23, 2022 at 7:09 PM Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:
>
> I'll take a look, but there's an unrelated problem:
> ANY ordered comparisons should spew warnings on bitwise

In the general case, absolutely.

But we have two special values that are the same in any bit ordering:
-1 and 0 (all bits set and no bits set). And yes, my patch verifies
that.

See commit 18f17cde ("allow restricted ordered compares with
unrestricted values") in that same tree.

That said, even those are strictly speaking only well-defined in
*unsigned* compares, so I guess we should add that - if you have a
*signed* bitwise thing, even those aren't well-defined to compare
against.

Now, I don't think signed bitwise types make much sense, and I
certainly hope we don't have them in the kernel, but yes, it is
probably worth adding that check too.

Of course, that check then depends on getting the signedness right for
bitwise types, which is exactly the problem I wanted you to look at ;)

Linus