From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 A5A72FC19; Thu, 25 Jul 2024 14:54:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721919257; cv=none; b=HTGSE2oHkwRyk8BoEnG9jG5chX6q8lA09ibt9wRKwsJC4uxt+cioLoaJXO9tR/LnQ5lgpiTo3u+C+Lh5eqweLdS1tFomuMZ1CreUNk0HMAPedG+Up4RGqFPzTcGHFBn8u8ulgCt7bzaa5idlbAFnAYQBbGvvAlkZPEfdiKp+tJw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721919257; c=relaxed/simple; bh=ojPpIkA3bsTx+JF72oESatB8moZrKblfbJBIfDWwm6g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uR9NFKMFjb/GGFFrTM/lWq81FwwmOir4kOEVJ+jNEt0iiKqOfu718ED3CBAONbDXbJ3ZHjxBEEJLVtxY136KmH57Q3O1PSO8kE6AMdr0uww9ngA9xlyUdm+VLsrcWZDEFq4AmMk5ROanFOF73yMjgSgYyB/qFGwIK6wMsDxNaEM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=f1ZwWQBu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="f1ZwWQBu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF90FC116B1; Thu, 25 Jul 2024 14:54:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1721919257; bh=ojPpIkA3bsTx+JF72oESatB8moZrKblfbJBIfDWwm6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f1ZwWQBuyf9qn3RDN+coJFLjyOQtdOdRvBgy/UPR0hj50R4jA0NF5r0GojBOHqJha mxbTthLxfTVhSlrBbxtBNT4vD5cltUF+YvcMh7xhKVp+sgSepG5xlleS2Ci9mITCwd CfvPARk2zfqKIfqUNYwC1xpMHxNPqkm2oZiPDf0Y= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Rasmus Villemoes , Steven Rostedt , Kees Cook , Bart Van Assche , Linus Torvalds , SeongJae Park Subject: [PATCH 5.15 64/87] tracing: Define the is_signed_type() macro once Date: Thu, 25 Jul 2024 16:37:37 +0200 Message-ID: <20240725142740.846142912@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240725142738.422724252@linuxfoundation.org> References: <20240725142738.422724252@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Bart Van Assche commit a49a64b5bf195381c09202c524f0f84b5f3e816f upstream. There are two definitions of the is_signed_type() macro: one in and a second definition in . As suggested by Linus, 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. Link: https://lore.kernel.org/all/CAHk-=whjH6p+qzwUdx5SOVVHjS3WvzJQr6mDUwhEyTf6pJWzaQ@mail.gmail.com/ Link: https://lore.kernel.org/all/CAHk-=wjQGnVfb4jehFR0XyZikdQvCZouE96xR_nnf5kqaM5qqQ@mail.gmail.com/ Cc: Rasmus Villemoes Cc: Steven Rostedt Acked-by: Kees Cook Signed-off-by: Bart Van Assche Signed-off-by: Linus Torvalds (cherry picked from commit a49a64b5bf195381c09202c524f0f84b5f3e816f) Signed-off-by: SeongJae Park Signed-off-by: Greg Kroah-Hartman --- include/linux/compiler.h | 6 ++++++ include/linux/overflow.h | 1 - include/linux/trace_events.h | 2 -- 3 files changed, 6 insertions(+), 3 deletions(-) --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -247,6 +247,12 @@ static inline void *offset_to_ptr(const #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. */ --- a/include/linux/overflow.h +++ b/include/linux/overflow.h @@ -29,7 +29,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)) --- a/include/linux/trace_events.h +++ b/include/linux/trace_events.h @@ -801,8 +801,6 @@ extern int trace_add_event_call(struct t 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,