linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kim.phillips@amd.com
Cc: linux-perf-users@vger.kernel.org
Subject: [bug report] perf env: Add perf_env__cpuid, perf_env__{nr_}pmu_mappings
Date: Mon, 18 Jul 2022 16:15:09 +0300	[thread overview]
Message-ID: <YtVc3cwnlxCWtyEv@kili> (raw)

Hello Kim Phillips,

This is a semi-automatic email about new static checker warnings.

The patch 9fe8895a27a8: "perf env: Add perf_env__cpuid,
perf_env__{nr_}pmu_mappings" from Aug 17, 2021, leads to the
following Smatch complaint:

    tools/perf/util/env.c:467 perf_env__cpuid()
    error: we previously assumed 'env' could be null (see line 461)

tools/perf/util/env.c
   457  const char *perf_env__cpuid(struct perf_env *env)
   458  {
   459          int status;
   460  
   461          if (!env || !env->cpuid) { /* Assume local operation */
   462                  status = perf_env__read_cpuid(env);
   463                  if (status)
   464                          return NULL;

If env is NULL and perf_env__read_cpuid() return zero then we are
toasted.

   465          }
   466  
   467          return env->cpuid;
   468  }

A couple of the neighboring functions are written the same way.  I'm not
sure why they don't generate checker warnings.

regards,
dan carpenter

             reply	other threads:[~2022-07-18 13:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-18 13:15 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-02-08 11:22 [bug report] perf env: Add perf_env__cpuid, perf_env__{nr_}pmu_mappings Dan Carpenter
2022-02-09 15:09 ` Jiri Olsa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YtVc3cwnlxCWtyEv@kili \
    --to=dan.carpenter@oracle.com \
    --cc=kim.phillips@amd.com \
    --cc=linux-perf-users@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).