From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0F0D5CCD184 for ; Mon, 6 Oct 2025 12:16:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=dClZpnB1PEMO1e9oEgVIbE6SUTXtf3TPYMR6goef6rc=; b=kQ+iD+igCdvqeEc1F0bJAOrnHd l9nwqzEplChHgk3KuEfqWA4nRzqPU3xgGW9BttZfysi0PhP0SCavDlnF7Jf7WYySaEShUvhxMSgMK jYJF2CwK2VX1pCRmyM48PFgSos+QtniQkEHgxlUDcaFjlFl+fg25AlTJ6wSej4yHcffgT74hDrBIk 6VYOkRqQzk5BuyDqD6gKoNZBmXl1KbpriU5I9YBRQOmXoymShrbtuTFx7dTvhIBCMbqZUImJX07Vz tQ2uTKi42FktLCY5i8cdhVZZwCjosWxjdlvlS1WfTCAdPkHAx6LriD3B0yKIusHsFbTB1Ff7jSsbC G4Gc4LRQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1v5k8l-0000000HZ44-0lhv; Mon, 06 Oct 2025 12:16:31 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uzYCZ-00000002Wit-3cEl; Fri, 19 Sep 2025 10:18:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=dClZpnB1PEMO1e9oEgVIbE6SUTXtf3TPYMR6goef6rc=; b=XfG2gek2KzJwC/NxgwOzSR43Hi fMJary6WgcfIpMOzX6BpGQ4+m8/agRHxtU8j2j4KC0lXleT0Phpqec0NRS5cmC40cnj8MvuKNsR40 dHYJ+PPwux5n9Mg7bS+tveJGEXP9sQ6fY/ZJt0KCW5d7oixEp+hATIeGexsXxtnyUFIXiQpttqwvG mSz1lSaPltrejXLmG/RfIiGef9Pz09XMg7g+T71PWS1lmk5MLYrMQBzldIrOcSS+I/HgwjR/+rN38 W3hSRkUpjtHXpynAifakeRY/jiKewqK6HtuK0ycH5Rtx9MSr4t+rAZPFR5KrxmxixD7Up7hwLl+VB /M0lfCKA==; Received: from fra-out-009.esa.eu-central-1.outbound.mail-perimeter.amazon.com ([3.64.237.68]) by desiato.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uzYCW-00000007pBz-1R30; Fri, 19 Sep 2025 10:18:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1758277128; x=1789813128; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dClZpnB1PEMO1e9oEgVIbE6SUTXtf3TPYMR6goef6rc=; b=UO01m2YINBp0hiTBJFjPoDmzUHkfsWggcMHDvE8l85Jsu/Cw2LfEix/U 9EM+GgxEhZbNQJv+zt0Ow4LWpvBNtcWjQu13JJmSsEKoG7kYXkCrdxtod Rabb7KBnwp9VRKKYDXt0H+hAdsCl4oYCbZK9frijdcf3/eTfoKhc8Poth UpSUzKT33PstorqB1DJOFB81SbT4R9CQ/qX885ZiuNmNj69ZQLhR1s0Uh mC+Fgqv40wyuHlurY31phNXbBbgVofiR2cOhNfHIuzM4G/DHEHFDt3qtv dVEckejSrHrp+oId9mybn8EeMEZSwEJN0vjE7os2pjasUBBckgcGPKxt1 g==; X-CSE-ConnectionGUID: GLhnOKfFTUu6Iz6rwLpTJg== X-CSE-MsgGUID: NeqqtmnWS5GXUDmb7libAg== X-IronPort-AV: E=Sophos;i="6.18,277,1751241600"; d="scan'208";a="2267348" Received: from ip-10-6-6-97.eu-central-1.compute.internal (HELO smtpout.naws.eu-central-1.prod.farcaster.email.amazon.dev) ([10.6.6.97]) by internal-fra-out-009.esa.eu-central-1.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2025 10:18:35 +0000 Received: from EX19MTAEUA002.ant.amazon.com [54.240.197.232:12600] by smtpin.naws.eu-central-1.prod.farcaster.email.amazon.dev [10.0.8.212:2525] with esmtp (Farcaster) id a79f11a8-4b8d-4d02-91a9-29883525fa8d; Fri, 19 Sep 2025 10:18:35 +0000 (UTC) X-Farcaster-Flow-ID: a79f11a8-4b8d-4d02-91a9-29883525fa8d Received: from EX19D018EUA004.ant.amazon.com (10.252.50.85) by EX19MTAEUA002.ant.amazon.com (10.252.50.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.20; Fri, 19 Sep 2025 10:18:33 +0000 Received: from dev-dsk-farbere-1a-46ecabed.eu-west-1.amazon.com (172.19.116.181) by EX19D018EUA004.ant.amazon.com (10.252.50.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.20; Fri, 19 Sep 2025 10:18:02 +0000 From: Eliav Farber To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , Arnd Bergmann , Dan Williams , Eric Dumazet , "Isabella Basso" , Josh Poimboeuf , "Masami Hiramatsu" , Nathan Chancellor , Sander Vanheule , Vlastimil Babka , Yury Norov Subject: [PATCH 01/27 5.10.y] overflow, tracing: Define the is_signed_type() macro once Date: Fri, 19 Sep 2025 10:17:01 +0000 Message-ID: <20250919101727.16152-2-farbere@amazon.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20250919101727.16152-1-farbere@amazon.com> References: <20250919101727.16152-1-farbere@amazon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [172.19.116.181] X-ClientProxiedBy: EX19D043UWC001.ant.amazon.com (10.13.139.202) To EX19D018EUA004.ant.amazon.com (10.252.50.85) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250919_111848_568234_AA953D25 X-CRM114-Status: GOOD ( 17.06 ) X-Mailman-Approved-At: Mon, 06 Oct 2025 05:16:26 -0700 X-BeenThere: linux-um@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-um" Errors-To: linux-um-bounces+linux-um=archiver.kernel.org@lists.infradead.org From: Bart Van Assche [ Upstream commit 92d23c6e94157739b997cacce151586a0d07bb8a ] There are two definitions of the is_signed_type() macro: one in and a second definition in . As suggested by Linus Torvalds, move the definition of the is_signed_type() macro into the header file. Change the definition of the is_signed_type() macro to make sure that it does not trigger any sparse warnings with future versions of sparse for bitwise types. See also: https://lore.kernel.org/all/CAHk-=whjH6p+qzwUdx5SOVVHjS3WvzJQr6mDUwhEyTf6pJWzaQ@mail.gmail.com/ https://lore.kernel.org/all/CAHk-=wjQGnVfb4jehFR0XyZikdQvCZouE96xR_nnf5kqaM5qqQ@mail.gmail.com/ Cc: Andrew Morton Cc: Arnd Bergmann Cc: Dan Williams Cc: Eric Dumazet Cc: Ingo Molnar Cc: Isabella Basso Cc: "Jason A. Donenfeld" Cc: Josh Poimboeuf Cc: Luc Van Oostenryck Cc: Masami Hiramatsu Cc: Nathan Chancellor Cc: Peter Zijlstra Cc: Rasmus Villemoes Cc: Sander Vanheule Cc: Steven Rostedt Cc: Vlastimil Babka Cc: Yury Norov Signed-off-by: Bart Van Assche Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220826162116.1050972-3-bvanassche@acm.org Signed-off-by: Eliav Farber --- include/linux/compiler.h | 6 ++++++ include/linux/overflow.h | 1 - include/linux/trace_events.h | 2 -- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/linux/compiler.h b/include/linux/compiler.h index bbd74420fa21..004a030d5ad2 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -245,6 +245,12 @@ static inline void *offset_to_ptr(const int *off) /* &a[0] degrades to a pointer: a different type from an array */ #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) +/* + * Whether 'type' is a signed type or an unsigned type. Supports scalar types, + * bool and also pointer types. + */ +#define is_signed_type(type) (((type)(-1)) < (__force type)1) + /* * This is needed in functions which generate the stack canary, see * arch/x86/kernel/smpboot.c::start_secondary() for an example. diff --git a/include/linux/overflow.h b/include/linux/overflow.h index 35af574d006f..66dd311ad8eb 100644 --- a/include/linux/overflow.h +++ b/include/linux/overflow.h @@ -32,7 +32,6 @@ * https://mail-index.netbsd.org/tech-misc/2007/02/05/0000.html - * credit to Christian Biere. */ -#define is_signed_type(type) (((type)(-1)) < (type)1) #define __type_half_max(type) ((type)1 << (8*sizeof(type) - 1 - is_signed_type(type))) #define type_max(T) ((T)((__type_half_max(T) - 1) + __type_half_max(T))) #define type_min(T) ((T)((T)-type_max(T)-(T)1)) diff --git a/include/linux/trace_events.h b/include/linux/trace_events.h index 5af2acb9fb7d..0c8c3cf36f96 100644 --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -700,8 +700,6 @@ extern int trace_add_event_call(struct trace_event_call *call); extern int trace_remove_event_call(struct trace_event_call *call); extern int trace_event_get_offsets(struct trace_event_call *call); -#define is_signed_type(type) (((type)(-1)) < (type)1) - int ftrace_set_clr_event(struct trace_array *tr, char *buf, int set); int trace_set_clr_event(const char *system, const char *event, int set); int trace_array_set_clr_event(struct trace_array *tr, const char *system, -- 2.47.3