Re: [PATCH v2] tracing: Make is_signed_type() compatible with sparse

From: Bart Van Assche

Date: Tue Sep 01 2026 - 15:59:13 EST


On 9/1/26 11:45 AM, Linus Torvalds wrote:
I think we should fix this in sparse, not in the kernel.

There is no reason for "is this a signed type" to be that complicated,
and add that kind of nasty code in a header that is this fundamental
to the kernel and gets included in every single file that gets
compiled.

Basic rule: sparse should never make the kernel worse.

Hi Linus,

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;

Source: https://lore.kernel.org/all/CAHk-=wjQGnVfb4jehFR0XyZikdQvCZouE96xR_nnf5kqaM5qqQ@xxxxxxxxxxxxxx/

Is that change still considered the best fix for sparse? If so, who can
apply that change to the sparse code base?

Thanks,

Bart.