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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VcsV8t2-6GB24Rz003B2JSAEOBjWD7B7FjEXuCQhkJ5pQ@mail.gmail.com>
Date: Mon, 8 Jan 2024 10:32:14 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Steven Rostedt <rostedt@...dmis.org>
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, 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.


> +               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;
    ...
  }

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ