lkml.org 
[lkml]   [2024]   [Mar]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] tracing: Use strcmp() in __assign_str() WARN_ON() check
On Wed, 13 Mar 2024 09:59:03 -0700
Nathan Chancellor <nathan@kernel.org> wrote:

> > Reported-by: kernel test robot <lkp@intel.com>
> > 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

\
 
 \ /
  Last update: 2024-03-13 19:47    [W:0.034 / U:4.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site