Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp325071lqt; Mon, 18 Mar 2024 08:52:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXulBXUHxRMDcNt3k+2qDBjWk2bVYPevg6FA6LXqsIQwEt3TxWlZwp+2uAp2KtM13oRz/0yMlg5tpyZXQkJ9pRxrfpJkNBgJoHcgrp2Qw== X-Google-Smtp-Source: AGHT+IEMM3E/O6otNuKLM2CsOyO8oiqpGXUwm4UwH08+/++IvZsvSw7dHJU4kYEGP3HFgteT/tgD X-Received: by 2002:a19:ca49:0:b0:513:e4bc:824e with SMTP id h9-20020a19ca49000000b00513e4bc824emr3401959lfj.57.1710777133333; Mon, 18 Mar 2024 08:52:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710777133; cv=pass; d=google.com; s=arc-20160816; b=p2DwR0N88Flj+f2Urnf/GiHPpVULBx9TID2q8Vo1ZSR12c6l5BDqJHnfxrIiZxLQ72 UT+/SLoNw6bq0Ygypipjg7+MYTcofuBIydxZEPUxE6nrsLWBLN7wrppLSlOtlocJ+eEq SaMWfBnHY4zA+fiDV63GWNxvya5Cqn2AuhrgAUW2v4vgMdrOUMjsp1lzH5VF/3M/GmvQ dCHnYhpTIrXZSduDuZUDHVccTK5TH0DgLM3axcKnen9bc6bDRBv9Du2AC0Z10RcYP8Dy Q3cppU6FHNnsXKHrtocBg63pOiobICXVd0NSGg30f4n3uht66rKSck824OiqSwC9uSS/ aJog== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=KU045L/XTIX13QyfYPHz59h9t6a8/SFBkYP4KS+XbkY=; fh=RQ6uWxKjoOgoAiGfxZ0wdGwkXrWH4hxJKyBEilfBoYY=; b=MqxyOgbm6miVj1rsNPnULJbCNEGgGPPvJeMHSzhxgaYJc7HCp5HLHPseWwjs3KnwZp 1ssO+7PME300gvmTAQbN9q0IBWhiqtOiBVrnxpNKs2J1sWF46u8AeMrTk9ryCAd7gabu i194aqDtEwquurzaNR3pvzPh1trTWSNELEMFqPhGQZ14rDYV85Unxjz+NuGfHS1K+WMP Uz/RMwMFcMd9He+6Z1vfCeL+RL19hbhj8GRqAmeQGB/vVTZRvSjIP2DwNoAQOkx94I4d 1txd0WPyhXwFCrXyFS+sFPJ0kkz76gw6HFzwo1SGamATYJQHrKFDNrju8vwsAmbmeZYy UKHg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=q4vsvdxA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-106322-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106322-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id qk35-20020a1709077fa300b00a46a7e6c919si2242847ejc.941.2024.03.18.08.52.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 08:52:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106322-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=q4vsvdxA; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-106322-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106322-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 115281F234E4 for ; Mon, 18 Mar 2024 15:43:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 878ED52F79; Mon, 18 Mar 2024 15:43:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="q4vsvdxA" 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 9E4FC524BD; Mon, 18 Mar 2024 15:43:04 +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=1710776584; cv=none; b=uegpGwZG+iwiA5YO1Zc0D0FZwjneWlUnjXFw0GzCTEanQQDnzGDYZTkp6KnIwgz8qyPV7CxOLHRZ8WAbpRyEjPuteobM7zuwtL+KTbb2075bY2H504/G2Wv3/JY9OPFeSDFD85sG5i26k5uHIJ6VcQ3sWPJObgK09diAaXsMWtU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710776584; c=relaxed/simple; bh=qhMgOtaICUkeTtfPcfP/CSjZBvXls4O81TYsjiRoEvQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=MKVIf6fXhcqmosQBu4qN5b47art7EimJQ3a3CTZOS2LW2tMsCL2vYSMdmnmXmOeBD2lB6tXj0KFepau5CTv9pa+Xfy7lYveFRE9ki0HwFoblmYkk+hklHgFKM/A+mXzCwUP1FQS7XBI9/1mFAgrckK9gs2OwLMAgBNAQU8rHFn4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=q4vsvdxA; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80050C433F1; Mon, 18 Mar 2024 15:43:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710776584; bh=qhMgOtaICUkeTtfPcfP/CSjZBvXls4O81TYsjiRoEvQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=q4vsvdxAU2l9z+ABU4RNeEHXMVDq+x6oeTzCY4PBlnTBwWbudF9cqa3JqwhJrZjiq cqasOHoiPvZRptYizIAOrw7xVPey3bDT7Tyjy5Ykrz9fRs5sgAoZMVCNcovf0uDzjk kp+PK/zTi4ecEIlvmiopxrMmztkLm/kriYVibp8QpGpN9ElLgrfgs7fOjH84T4MUH7 L0ZgdVRhj4ay96G30DD5vPXI2AX36Y7E4HU/K8f656bzaZ4qQwmjksSBEvpbUazver GJcoyshDydV88jViUQBbX9r2PJZ+Jk80X5qdyUhKv21BctkaLQv3rDdgnfrem301EG Gk1NfGnFxDM8Q== Date: Mon, 18 Mar 2024 08:43:00 -0700 From: Nathan Chancellor To: Naresh Kamboju Cc: Netdev , clang-built-linux , open list , lkft-triage@lists.linaro.org, "David S. Miller" , Trond Myklebust , Eric Dumazet , rostedt@goodmis.org, linux-trace-kernel@vger.kernel.org Subject: Re: net/sunrpc/sched.c: error: result of comparison against a string literal is unspecified (use an explicit string comparison function instead) Message-ID: <20240318154300.GA816320@dev-arch.thelio-3990X> References: 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=us-ascii Content-Disposition: inline In-Reply-To: Hi Naresh, On Mon, Mar 18, 2024 at 02:55:54PM +0530, Naresh Kamboju wrote: > The following build warnings / errors noticed on x86 kselftests build with > clang nightly / clang-17 on Linux next tag next-20240318. > > This build config is generated from kselftest merge configs [1]. > > Reported-by: Linux Kernel Functional Testing > > Build log: > ----------- > In file included from net/sunrpc/sched.c:31: > In file included from include/trace/events/sunrpc.h:2524: > In file included from include/trace/define_trace.h:102: > In file included from include/trace/trace_events.h:419: > include/trace/events/sunrpc.h:707:4: error: result of comparison > against a string literal is unspecified (use an explicit string > comparison function instead) [-Werror,-Wstring-compare] > 667 | __assign_str(progname, > | ~~~~~~~~~~~~~~~~~~~~~~ > 668 | task->tk_client->cl_program->name); > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 669 | __entry->version = task->tk_client->cl_vers; > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 670 | __assign_str(procedure, > task->tk_msg.rpc_proc->p_name); > | Thanks for the report. This is caused by commit 433e1d88a3be ("tracing: Add warning if string in __assign_str() does not match __string()") from the tracing tree, not a change on the netdev side (although I have left them on CC for this reply so they are aware of that). To resolve it, [1] needs to be applied then the following diff can be applied on top of that to fully clear it up (as __builtin_constant_p() does not influence diagnostics in the front end, so the warning still triggers on the else branch when it will really use strcmp(), as Steve tested at [2]). [1]: https://lore.kernel.org/20240312113002.00031668@gandalf.local.home/ [2]: https://lore.kernel.org/20240313161420.3b668558@gandalf.local.home/ diff --git a/include/trace/stages/stage6_event_callback.h b/include/trace/stages/stage6_event_callback.h index 83da83a0c14f..dbd27adb1b83 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, 13, "-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'; \