# Re: \[PATCH\] tracing: Use strcmp() in \_\_assign\_str() WARN\_ON() check

- From: Steven Rostedt \<rostedt@goodmis.org\>
- Date: 2024-03-13 17:43:43 
- List: linux-trace-kernel
- Page: https://ratatoskr.run/linux-trace-kernel/2024/03/2531150
- Thread: https://ratatoskr.run/linux-trace-kernel/2024/03/2529371/t.md

```text
On Wed, 13 Mar 2024 09:59:03 -0700
Nathan Chancellor [ref] wrote:

> > Reported-by: kernel test robot <redacted>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202402292111.KIdExylU-lkp@intel.com/
> > Fixes: 433e1d88a3be ("tracing: Add warning if string in __assign_str() does not match __string()")  
> 
> Is this change destined for 6.9 or 6.10? I applied it to current
> trace/core (eb1533d156d3) along with 51270d573a8d but the warning is
> still present. I even tried
> 
>     __builtin_choose_expr(__is_constexpr((src)),
>                          strcmp((src), __data_offsets.dst##_ptr_),
>                          (src) != __data_offsets.dst##_ptr_));
> 
> but not even that silenced the warning. I think we will still need a
> diag directive to fully silence this warning.

Yes, you said that the warning is still there, but the bug it shows should
not be.

I believe that's because clang still evaluates the (src) != ... even when
the source is a contast and it warns about it. But if src is a constant, we
do not want to do the !=, we want to do the slower strcmp().

Let me test to make sure that when src is a string "like this" that it does
the strcmp(). Otherwise, we may have to always do the strcmp(), which I
really would like to avoid.

BTW, I triggered another bug with strcmp():

  https://lore.kernel.org/all/20240313093454.3909afe7@gandalf.local.home/

-- Steve
```
