Re: [PATCH v2] tracing: Make is_signed_type() compatible with sparse
From: Linus Torvalds
Date: Tue Sep 01 2026 - 15:43:36 EST
On Tue, 1 Sept 2026 at 12:22, Bart Van Assche <bvanassche@xxxxxxx> wrote:
>
> Four years ago the following sparse change was proposed:
>
> static int restricted_value(struct expression *v, struct symbol *type)
> {
> - if (v->type == EXPR_CAST)
> + if (v->type == EXPR_CAST || v->type == EXPR_FORCE_CAST)
> v = v->cast_expression;
Oh, that's why I've not seen that issue. Because I still have that
exact thing in my tree, and have had it forever:
commit 32eb1e2c4fa0ae77b72aeaff963d49c309ab867a
Author: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Date: Thu Oct 20 18:10:07 2022 -0700
Allow both regular casts and forced casts for restricted values
We probably should just just a single expression type for the two cases,
and distinguish forced casts some other way, but that's a separate
issue.
Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
but I think I stopped pushing out my own tree long ago I started
rebasing things and others maintained sparse better.
> Is that change still considered the best fix for sparse? If so, who can
> apply that change to the sparse code base?
Well, I pushed out my own random branch to my tree, but my sparse tree
really is a horrible mess of rebased code. So it for example has been
rebased on top of Al's __VA_OPT__ code from earlier this year, and
then has my own random old local patches from four years ago on top of
that.
So no, that tree is *not* a good tree, but I pushed it out anyway
since that horribly ugly tree is at least somewhat relevant to this
discussion.
Does that tree at least work for you? Maybe we can convince somebody
who is a better maintainer than I clearly have ever been to make my
messy branch be something actually palatable...
Linus