linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>,
	LKML <linux-kernel@vger.kernel.org>,
	 Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>,
	netdev <netdev@vger.kernel.org>
Cc: Yisen Zhuang <yisen.zhuang@huawei.com>,
	Salil Mehta <salil.mehta@huawei.com>,
	 Jijie Shao <shaojijie@huawei.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Yufeng Mo <moyufeng@huawei.com>,
	Huazhong Tan <tanhuazhong@huawei.com>
Subject: Re: [PATCH] net: hns3: tracing: fix hclgevf trace event strings
Date: Thu, 14 Mar 2024 15:39:28 +0100	[thread overview]
Message-ID: <8607787b42e80503e0259f41e0bcc2d3ff770355.camel@redhat.com> (raw)
In-Reply-To: <20240313093454.3909afe7@gandalf.local.home>

On Wed, 2024-03-13 at 09:34 -0400, Steven Rostedt wrote:
> From: "Steven Rostedt (Google)" <rostedt@goodmis.org>
> 
> [
>    Note, I need to take this patch through my tree, so I'm looking for acks.

Note that this device driver is changing quite rapidly, so I expect
some conflicts here later. I guess Liuns will have to handle them ;)

>    This causes the build to fail when I add the __assign_str() check, which
>    I was about to push to Linus, but it breaks allmodconfig due to this error.
> ]
> 
> The __string() and __assign_str() helper macros of the TRACE_EVENT() macro
> are going through some optimizations where only the source string of
> __string() will be used and the __assign_str() source will be ignored and
> later removed.
> 
> To make sure that there's no issues, a new check is added between the
> __string() src argument and the __assign_str() src argument that does a
> strcmp() to make sure they are the same string.
> 
> The hclgevf trace events have:
> 
>   __assign_str(devname, &hdev->nic.kinfo.netdev->name);
> 
> Which triggers the warning:
> 
> hclgevf_trace.h:34:39: error: passing argument 1 of ‘strcmp’ from incompatible pointer type [-Werror=incompatible-pointer-types]
>    34 |                 __assign_str(devname, &hdev->nic.kinfo.netdev->name);
>  [..]
> arch/x86/include/asm/string_64.h:75:24: note: expected ‘const char *’ but argument is of type ‘char (*)[16]’
>    75 | int strcmp(const char *cs, const char *ct);
>       |            ~~~~~~~~~~~~^~
> 
> 
> Because __assign_str() now has:
> 
> 	WARN_ON_ONCE(__builtin_constant_p(src) ?		\
> 		     strcmp((src), __data_offsets.dst##_ptr_) :	\
> 		     (src) != __data_offsets.dst##_ptr_);	\
> 
> The problem is the '&' on hdev->nic.kinfo.netdev->name. That's because
> that name is:
> 
> 	char			name[IFNAMSIZ]
> 
> Where passing an address '&' of a char array is not compatible with strcmp().
> 
> The '&' is not necessary, remove it.
> 
> Fixes: d8355240cf8fb ("net: hns3: add trace event support for PF/VF mailbox")

checkpactch in strict mode complains the hash is not 12 char long.

> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>

FWIW

Acked-by: Paolo Abeni <pabeni@redhat.com>


  parent reply	other threads:[~2024-03-14 14:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-13 13:34 [PATCH] net: hns3: tracing: fix hclgevf trace event strings Steven Rostedt
2024-03-14 11:48 ` Jijie Shao
2024-03-14 14:39 ` Paolo Abeni [this message]
2024-03-14 16:00   ` Steven Rostedt
2024-03-19 11:09     ` Simon Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8607787b42e80503e0259f41e0bcc2d3ff770355.camel@redhat.com \
    --to=pabeni@redhat.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=moyufeng@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=salil.mehta@huawei.com \
    --cc=shaojijie@huawei.com \
    --cc=tanhuazhong@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).