Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp976381lqt; Tue, 19 Mar 2024 09:10:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXVednJZsvpBFMk1gcAn5zqX/PYRtO0yLWB8r4K82nhteNWcqN/n4aHpkugugT+NfV8+V+Pe6lpuRhhSP7Gu8Dy+Y9AHbEKGKB1zm5qCQ== X-Google-Smtp-Source: AGHT+IHHxwwBZ0sjpgEU4riw9IH8QmgdSn+TkUm1njBxJBjbeh//QBXyKBRoEwOF+3JgslLL+GLp X-Received: by 2002:a17:90a:c245:b0:29f:7ad2:50e6 with SMTP id d5-20020a17090ac24500b0029f7ad250e6mr5919198pjx.32.1710864628941; Tue, 19 Mar 2024 09:10:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710864628; cv=pass; d=google.com; s=arc-20160816; b=VEtKNkJuSCN+T/ckclv5fnclBYTh+tg8TNweh9ugEJIwHygUCrTDhpUtCzXs19A42l gDOQDIArY7daBIE7eI9g+1BWcIubElhZ7iwbvO+S4sJd2YFsHJQIvuGnWNBChymvM73D EyRJZbyH/aalHTpMXZaRTmArC+xtjejsElX0Lbu7MyICE5cVPX04xsRzeAEkDtdmfNQ6 G0TTfJQ36Tkxv3NNSt56NOeI3sffl7OfYTOzHahq9zD2o9R/CgfxkREVT6UjrVjT1LGs EsgBs3x6W6H95YgXmyilpJOnnFDwTyDGJZrklmOKUckqw9Jcrsw/uSRlbUZDiX55jTFM H3NQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=qvqCu/dhizobS/qz6rjWYwum5/kJfPNezcD4hpdLtkk=; fh=i+7KkJXYhe+N9yCEt3Aj4zbv+1FKr6ZvUYMH+oAb5uw=; b=tItuDYkSLT5/oWMpi7kHeES6mfL+ixOzMYArvbzmFpDXereLKN87csNkbERUN8iO/q NUuc5EuZmIQbCqoOssA49eQmj+Js69dxiSsCMZo45XBcn1fgRNMJb7QoqCmIFPbn+MB9 Jkv6SUeEfrEytGvNKOBmIUezlSPQPShX4khw4rq006/0fT6KzmSX2UPoCo5kGVQ4Dhwp chvfmcTuQ5dDZ5IrYgX52nGZe8DCHudCrGJ6QuLglfnV8xPq8zQIqCPJA/Je9igjX4vI 9fXadtN5N1Mi6Pultbhyp3D06GaQHp2hMO+uGF8IDiQeDEcbact3wd+8d1koksfvSoBT ya9g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=E3tSh9A5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-107775-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107775-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id t8-20020a17090aba8800b0029bb0c14a42si10462743pjr.15.2024.03.19.09.10.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 09:10:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107775-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=E3tSh9A5; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-107775-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107775-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 07572283F0D for ; Tue, 19 Mar 2024 16:09:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4A61582D91; Tue, 19 Mar 2024 16:08:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="E3tSh9A5" 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 608AD823C4; Tue, 19 Mar 2024 16:08:02 +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=1710864482; cv=none; b=rK6IeZf4jOV6XOP9ohLQ5Dl5e5yxaublewFRrKQwitCPYOTTC6SPXpOIDWpyqFKsu3nvRZl5u22CV8SDde/SdZBjCrfgmKNiozESU5yaIyJkSghHdWJUgZ+Zmv+eYyrCcDQwVtcQOYI6uxydstQ7f3rUVhDSDPrL4NJZkB9ITcQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710864482; c=relaxed/simple; bh=w2V5d2UCp17oxIbLB5SOI4dH0DOO083lsUavf7oC++4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Dv9oimm/QW88JIv6Dgh01FPSdimIsAsh9j4dqV9qlwKvPRndxVVOeI8muMlVd0Ktvz5TfQPAqh4XkyDOjh7cAe1zgd9RXe/NlUAZLGjvQs2xa/0yLXJi0AW50a9G6HJDW63IPG2HTr3s5FCxgvV2uanwni1gskVfXKGw+a1sEK8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=E3tSh9A5; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60280C433B1; Tue, 19 Mar 2024 16:08:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710864482; bh=w2V5d2UCp17oxIbLB5SOI4dH0DOO083lsUavf7oC++4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=E3tSh9A5+XGqk4VZBDEd/MVbLWUCyGytI3xgprjfOtf3E8EYVjB1bHoWdT/UIzekT w9+Wy5Mqg+yQWRhsWudBzsdacxXg7NXQVH+ZPgnbfcH0kVnlbMx7tfajWSM9eUjXsn oNxqN7ugN2W7/M6wvZ7IAMe2Tt8vcgFWpdAZvkh6CScEW11jPU4fQh2MC1xH2VSIDW DRdyxUGsSg+44m1MW95V4f9vlQbkJ3rLIRCUo5HP6NGtGb5HQiF/gYDHmm8ibwdXNd H+dXSZpDJ0kzFF6MfdQ0otiGA+j1Ge96FyypYy84O7Phjw0MiS11zburvPfriokXNx XFHffYkUyaaGw== From: Nathan Chancellor Date: Tue, 19 Mar 2024 09:07:53 -0700 Subject: [PATCH 2/2] tracing: Ignore -Wstring-compare with diagnostic macros Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240319-tracing-fully-silence-wstring-compare-v1-2-81adb44403f5@kernel.org> References: <20240319-tracing-fully-silence-wstring-compare-v1-0-81adb44403f5@kernel.org> In-Reply-To: <20240319-tracing-fully-silence-wstring-compare-v1-0-81adb44403f5@kernel.org> To: rostedt@goodmis.org, mhiramat@kernel.org Cc: mathieu.desnoyers@efficios.com, ndesaulniers@google.com, morbo@google.com, justinstitt@google.com, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, Linux Kernel Functional Testing , Nathan Chancellor X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2414; i=nathan@kernel.org; h=from:subject:message-id; bh=w2V5d2UCp17oxIbLB5SOI4dH0DOO083lsUavf7oC++4=; b=owGbwMvMwCUmm602sfCA1DTG02pJDKk/d8R7Hs/lnXK5btVJPat/s5lNFeuF1v3onvZ1S8aea oUfdw8e6ShlYRDjYpAVU2Spfqx63NBwzlnGG6cmwcxhZQIZwsDFKQAT+bub4b+7dNrTHXVsa/9O +Mgoad3hwerOPyVwy6P95yY8ailrKGZhZLh0+HSu9apfVhN9DJ4ekH7tyWYXeH3G/jOTpzdIhK9 hEGYGAA== X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 Commit b1afefa62ca9 ("tracing: Use strcmp() in __assign_str() WARN_ON() check") addressed a clang warning, -Wstring-compare, with the use of __builtin_constant_p() to dispatch to strcmp() if the source string is a string literal and a direct comparison if not. Unfortunately, even with this change, the warning is still present because __builtin_constant_p() is not evaluated at this stage of the pipeline, so clang still thinks the else branch could occur for this situation: include/trace/events/sunrpc.h:705:4: error: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) [-Werror,-Wstring-compare] ... include/trace/stages/stage6_event_callback.h:40:15: note: expanded from macro '__assign_str' 40 | (src) != __data_offsets.dst##_ptr_); \ | ^ ... Use the compiler diagnostic macros to disable this warning around the WARN_ON_ONCE() expression since a string comparison function, strcmp(), will always be used for the comparison of string literals. Fixes: b1afefa62ca9 ("tracing: Use strcmp() in __assign_str() WARN_ON() check") Reported-by: Linux Kernel Functional Testing Closes: https://lore.kernel.org/all/CA+G9fYs=OTKAZS6g1P1Ewadfr0qoe6LgOVSohqkXmFXotEODdg@mail.gmail.com/ Signed-off-by: Nathan Chancellor --- include/trace/stages/stage6_event_callback.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/trace/stages/stage6_event_callback.h b/include/trace/stages/stage6_event_callback.h index 83da83a0c14f..56a4eea5a48e 100644 --- a/include/trace/stages/stage6_event_callback.h +++ b/include/trace/stages/stage6_event_callback.h @@ -35,9 +35,14 @@ do { \ char *__str__ = __get_str(dst); \ int __len__ = __get_dynamic_array_len(dst) - 1; \ + __diag_push(); \ + __diag_ignore(clang, 11, "-Wstring-compare", \ + "__builtin_constant_p() ensures strcmp()" \ + "will be used for string literals"); \ WARN_ON_ONCE(__builtin_constant_p(src) ? \ strcmp((src), __data_offsets.dst##_ptr_) : \ (src) != __data_offsets.dst##_ptr_); \ + __diag_pop(); \ memcpy(__str__, __data_offsets.dst##_ptr_ ? : \ EVENT_NULL_STR, __len__); \ __str__[__len__] = '\0'; \ -- 2.44.0