Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2886975rwb; Mon, 15 Aug 2022 13:19:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR6xXfPh5j9iZ9Y4foWT9R13b1yfU8JHMcEWTlxImTHKWXg1JoFtUyY1IyGbJI09zzcwaopG X-Received: by 2002:a17:907:a05a:b0:730:98b2:16d7 with SMTP id gz26-20020a170907a05a00b0073098b216d7mr11424640ejc.394.1660594791232; Mon, 15 Aug 2022 13:19:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660594791; cv=none; d=google.com; s=arc-20160816; b=XeGZlsSzdImzvlWVW0siy8IqdmA0flibZYzXsT64c4XN9PFiBEAJ24TdkeINd7mEOU Cej1BGcjhy079tHLkQRhsDFBIIcoUhdLtLTYGMVs3suAiqAiA6Ks1DE/6WtZMetcyH69 10LDHcNm/W8L6DeLD2lnX8yuw06BwW60kArIwLGQp1MHVfzzqLno9bTMmrZN5uEZYtp+ Fa9NKyfXrtm2X/9XR4vjdnUFu71BstUy+d5TriIQ2irjUPOnhee7jV+KYJnoTDPmM4cF txb/5qc7ARUoy+YiCG0YRmVxqFODhxESNvfH7FxwX8GeJaNR9v6vDufNBH99p+8zXB9C Q6xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sMUcLjnyWTLNEhIQ1UMYWlTAZFZAvd2N2lfSAXqtKWU=; b=YX9t6HHHG1Clu5z+4PtAxDiKwaCemvScL7etL3kyzbaFtZ1vsqd2hnZHk+i6ldf6d9 /4nW7hl7BtVQBG+AVcNAg6xf3Gz5QLJF+2mxFcQO093A7TnwYuVl9tgj54pvotI+Jsz2 4p5ODHeXh4F62EONX5y7l4x0BkngZQzEtu4cQW/Cynre/pAUP8Zxh3gedk94m6XEokAN nmEhqDDrsaH6pn2jwwj85SA6zC7xV3lurF1LtyF3Jeko8I/Wz3WcicgcCWZmthRWyvtM D3bmL33nrSEzKI/dQiUbwzUgb+Q0X0+qFw4s5x0nAntnFb0lUxBrERmnYW+wJTLHc7I5 LMeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xgkhp+5V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l19-20020a50d6d3000000b0043cae183e35si9032603edj.422.2022.08.15.13.19.25; Mon, 15 Aug 2022 13:19:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xgkhp+5V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233552AbiHOT5S (ORCPT + 99 others); Mon, 15 Aug 2022 15:57:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244214AbiHOTxs (ORCPT ); Mon, 15 Aug 2022 15:53:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAC7E45996; Mon, 15 Aug 2022 11:51:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3AAEAB810A2; Mon, 15 Aug 2022 18:51:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C5F6C433C1; Mon, 15 Aug 2022 18:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589506; bh=hnv1XE0p9Z6h0Gz83S5EsiaobBnLS3/MzDyCxzBMYV0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xgkhp+5VRR1Mc75Hyui8YL21ASzf5F4QNzagsLe0L2SOsWDge3ik86MXg7BHsOrY/ MUyHuJLesproGOGhIehryohv6VkCi+EruRzvgAH6Xiu6y/N1TA79M/B3O0/cXUzqDj POhqEoz391K/Z9C7KJitrl2wIe9OQ8bYnrsEYEaU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Rothwell , Kees Cook , Masami Hiramatsu , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.15 740/779] tracing: Avoid -Warray-bounds warning for __rel_loc macro Date: Mon, 15 Aug 2022 20:06:24 +0200 Message-Id: <20220815180409.073906833@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masami Hiramatsu [ Upstream commit 58c5724ec2cdd72b22107ec5de00d90cc4797796 ] Since -Warray-bounds checks the destination size from the type of given pointer, __assign_rel_str() macro gets warned because it passes the pointer to the 'u32' field instead of 'trace_event_raw_*' data structure. Pass the data address calculated from the 'trace_event_raw_*' instead of 'u32' __rel_loc field. Link: https://lkml.kernel.org/r/20220125233154.dac280ed36944c0c2fe6f3ac@kernel.org Cc: Stephen Rothwell Cc: Kees Cook Signed-off-by: Masami Hiramatsu [ This did not fix the warning, but is still a nice clean up ] Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin --- include/trace/trace_events.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h index 8c6f7c433518..65d927e059d3 100644 --- a/include/trace/trace_events.h +++ b/include/trace/trace_events.h @@ -318,9 +318,10 @@ TRACE_MAKE_SYSTEM_STR(); #define __get_str(field) ((char *)__get_dynamic_array(field)) #undef __get_rel_dynamic_array -#define __get_rel_dynamic_array(field) \ - ((void *)(&__entry->__rel_loc_##field) + \ - sizeof(__entry->__rel_loc_##field) + \ +#define __get_rel_dynamic_array(field) \ + ((void *)__entry + \ + offsetof(typeof(*__entry), __rel_loc_##field) + \ + sizeof(__entry->__rel_loc_##field) + \ (__entry->__rel_loc_##field & 0xffff)) #undef __get_rel_dynamic_array_len -- 2.35.1