From nobody Tue Sep 29 12:02:16 2026 Received: from 011.lax.mailroute.net (011.lax.mailroute.net [199.89.1.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53C1E39A4C4 for ; Fri, 7 Aug 2026 17:01:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786122078; cv=none; b=SyqN3b3gPFxq8meF1rXzQnCDzvzo5MBehulgiXZHkIL8VlTis70jS5ffXFdp9KKv3lIeNszshROyTfj8wFZN19AJAw9HXwJZ+QLtM8acEQVv2EBPd/mubv/SQt1PwLDCxsrXsolynIr9bIBUUNAlTu2E1QRU5zLXFQN+pwwe+p0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786122078; c=relaxed/simple; bh=ZS1YjBkgmsUn/orOYQVxGsD/C8EAcWETWVIxnbmILhk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=Gt7pcsF+iyol6EG557IBmZLqrjVo9jjwi/6c0iWa4mIT58+wnQB0ngsFs8RxAv52O3xIzdgv25+8w6cKc8Xca+tVvIgbM+1nqWKNBYiO+fKenL7y0XWd26b7YWkebQ6fDalq+6OhQ4+S3hrFMspSj5RvE2YHaEAYW/pXEJDFWEo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=DJfcGRJs; arc=none smtp.client-ip=199.89.1.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="DJfcGRJs" Received: from localhost (localhost [127.0.0.1]) by 011.lax.mailroute.net (Postfix) with ESMTP id 4hGr5R585Dz1XM6JJ; Fri, 7 Aug 2026 17:01:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:mime-version:x-mailer:message-id:date :date:subject:subject:from:from:received:received; s=mr01; t= 1786122070; x=1788714071; bh=MICe2OQznQePD7U0LnrsL8WadlI5DQbtpax uKy5EZxI=; b=DJfcGRJs+SQkaeXfEO5BJKt4t7+1MiS9p7473E6o6+UhAokmcrp 1l1w641ToBnq1EeFQCiW979/D6OYOoIt4oKx+SEDS6GgRXp+hXepQ1ZI9VQBnF2o 3oKS1raFCO3tDlr2mhE1wUVdRpM7n+xohUCAKNHf7TbfkfSujCFEQ6+hJ7dgNwXK Pg1P27SPPKnXTKhU2tgLSjKfgi2P7NePRk/BC7oghnunxvgSH2jLr3RTjXrcra/N riResdlBo9o9yNr6Z3Yi1N/yf5wvQje8rgF0McsglyEScx8tiwgaPc3Ho8IW8oy+ VygmOHOI6DAiqlT4PcbyAy3sPNifrWABLQg== X-Virus-Scanned: by MailRoute Received: from 011.lax.mailroute.net ([127.0.0.1]) by localhost (011.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id Oln7cCEIY2Dj; Fri, 7 Aug 2026 17:01:10 +0000 (UTC) Received: from bvanassche.mtv.corp.google.com (unknown [104.135.180.219]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 011.lax.mailroute.net (Postfix) with ESMTPSA id 4hGr5K0KpZz1XM4Tn; Fri, 7 Aug 2026 17:01:08 +0000 (UTC) From: Bart Van Assche To: Steven Rostedt Cc: linux-kernel@vger.kernel.org, Bart Van Assche , Christoph Hellwig , Rasmus Villemoes , Luc Van Oostenryck , Linus Torvalds , Chris Li Subject: [PATCH v2] tracing: Make is_signed_type() compatible with sparse Date: Fri, 7 Aug 2026 10:00:56 -0700 Message-ID: X-Mailer: git-send-email 2.55.0.679.g6767b8d81c-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Using a __bitwise type in a tracing __field() definition triggers four sparse warnings in stage 4 of expanding the TRACE_EVENT() macro. These warnings are triggered by the is_signed_type() macro implementation. Fix this by using _Generic() in the is_signed_type() implementation instead of an integer comparison. An earlier attempt to fix this issue is available here: https://lore.kernel.org/all/20220717151047.19220-1-bvanassche@acm.org/ Cc: Christoph Hellwig Cc: Rasmus Villemoes Cc: Luc Van Oostenryck Cc: Linus Torvalds Signed-off-by: Bart Van Assche --- Changes compared to v1: removed #ifdef __CHECKER__. include/linux/compiler.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index cb2f6050bdf7..ba9c7e16802d 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -326,7 +326,14 @@ static inline void *offset_to_ptr(const int *off) * Whether 'type' is a signed type or an unsigned type. Supports scalar ty= pes, * bool and also pointer types. */ -#define is_signed_type(type) (((type)(-1)) < (__force type)1) +#define is_signed_type(type) _Generic((type)0, \ + signed char: true, \ + signed short: true, \ + signed int: true, \ + signed long: true, \ + signed long long: true, \ + char: ((char)-1 < (char)1), \ + default: false) #define is_unsigned_type(type) (!is_signed_type(type)) =20 /*