lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Mon, 8 Jan 2024 10:21:15 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: LKML <linux-kernel@...r.kernel.org>, Linux Trace Kernel
 <linux-trace-kernel@...r.kernel.org>, Masami Hiramatsu
 <mhiramat@...nel.org>, Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
 Andy Shevchenko <andy@...nel.org>, Tom Zanussi <zanussi@...nel.org>
Subject: Re: [PATCH] tracing histograms: Simplify parse_actions() function

On Mon, 8 Jan 2024 10:32:14 +0200
Andy Shevchenko <andy.shevchenko@...il.com> wrote:

> On Mon, Jan 8, 2024 at 3:31 AM Steven Rostedt <rostedt@...dmis.org> wrote:
> >
> > From: "Steven Rostedt (Google)" <rostedt@...dmis.org>
> >
> > The parse_actions() function uses 'len = str_has_prefix()' to test which
> > action is in the string being parsed. But then it goes and repeats the
> > logic for each different action. This logic can be simplified and
> > duplicate code can be removed as 'len' contains the length of the found
> > prefix which should be used for all actions.  
> 
> > Link: https://lore.kernel.org/all/20240107112044.6702cb66@gandalf.local.home/
> >
> > Signed-off-by: Steven Rostedt (Google) <rostedt@...dmis.org>  
> 
> If you want Link to be formally a tag, you should drop the following
> blank line.

The link is for humans not for parsers.

> 
> 
> > +               if ((len = str_has_prefix(str, "onmatch(")))
> > +                       hid = HANDLER_ONMATCH;
> > +               else if ((len = str_has_prefix(str, "onmax(")))
> > +                       hid = HANDLER_ONMAX;
> > +               else if ((len = str_has_prefix(str, "onchange(")))
> > +                       hid = HANDLER_ONCHANGE;  
> 
> The repeating check for ( might be moved out as well after this like
> 
>   if (str[len] != '(') {
>     // not sure if you need data to be assigned here as well
>     ret = -EINVAL;
>     ...
>   }
> 

Not sure how that makes it any better. It adds more code. I could start
with checking the "on" before checking for "match", "max" and "change", but
that just makes it more complex.

-- Steve


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ