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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAM9d7ciTYqS0UzKbC-GPGCVi8Rq9Ooetvh-EKGkZe6A1f=qn0g@mail.gmail.com>
Date:   Tue, 22 Nov 2022 10:31:16 -0800
From:   Namhyung Kim <namhyung@...nel.org>
To:     yang.yang29@....com.cn
Cc:     mingo@...hat.com, acme@...nel.org, mark.rutland@....com,
        alexander.shishkin@...ux.intel.com, jolsa@...nel.org,
        irogers@...gle.com, james.clark@....com, kan.liang@...ux.intel.com,
        zhengjun.xing@...ux.intel.com, cjense@...gle.com,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
        xu.panda@....com.cn
Subject: Re: [PATCH linux-next] perf stat: use sysfs_streq() instead of strncmp()

Hello,

On Tue, Nov 22, 2022 at 4:11 AM <yang.yang29@....com.cn> wrote:
>
> From: Xu Panda <xu.panda@....com.cn>
>
> Replace the open-code with sysfs_streq().

I don't think it's equivalent to strncmp() and it seems not available
in the tools.

Thanks,
Namhyung

>
> Signed-off-by: Xu Panda <xu.panda@....com.cn>
> Signed-off-by: Yang Yang <yang.yang29@....com>
> ---
>  tools/perf/util/stat-display.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-display.c
> index f5501760ff2e..1fd9f7e9d2a1 100644
> --- a/tools/perf/util/stat-display.c
> +++ b/tools/perf/util/stat-display.c
> @@ -463,7 +463,7 @@ static bool valid_only_metric(const char *unit)
>  static const char *fixunit(char *buf, struct evsel *evsel,
>                            const char *unit)
>  {
> -       if (!strncmp(unit, "of all", 6)) {
> +       if (sysfs_streq(unit, "of all")) {
>                 snprintf(buf, 1024, "%s %s", evsel__name(evsel),
>                          unit);
>                 return buf;
> @@ -767,8 +767,7 @@ static void uniquify_event_name(struct evsel *counter)
>         int ret = 0;
>
>         if (counter->uniquified_name || counter->use_config_name ||
> -           !counter->pmu_name || !strncmp(counter->name, counter->pmu_name,
> -                                          strlen(counter->pmu_name)))
> +           !counter->pmu_name || sysfs_streq(counter->name, counter->pmu_name))
>                 return;
>
>         config = strchr(counter->name, '/');
> --
> 2.15.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ