All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: robin.murphy@arm.com
Cc: linux-arm-kernel@lists.infradead.org
Subject: [bug report] perf: Add Arm CMN-600 PMU driver
Date: Wed, 30 Sep 2020 17:34:44 +0300	[thread overview]
Message-ID: <20200930143444.GA651504@mwanda> (raw)

Hello Robin Murphy,

The patch 0ba64770a2f2: "perf: Add Arm CMN-600 PMU driver" from Sep
18, 2020, leads to the following static checker warning:

	drivers/perf/arm-cmn.c:1156 arm_cmn_pmu_offline_cpu()
	error: potential NULL dereference 'cmn'.

drivers/perf/arm-cmn.c
  1150  static int arm_cmn_pmu_offline_cpu(unsigned int cpu, struct hlist_node *node)
  1151  {
  1152          struct arm_cmn *cmn;
  1153          unsigned int target;
  1154  
  1155          cmn = hlist_entry_safe(node, struct arm_cmn, cpuhp_node);
  1156          if (cpu != cmn->cpu)
                           ^^^^^^^^
It doesn't make sense to use hlist_entry_safe() and then dereference
"cmn" without checking for NULL.  It should either be hlist_entry() or
there should be a NULL check.

  1157                  return 0;
  1158  
  1159          target = cpumask_any_but(cpu_online_mask, cpu);
  1160          if (target >= nr_cpu_ids)
  1161                  return 0;
  1162  
  1163          perf_pmu_migrate_context(&cmn->pmu, cpu, target);
  1164          cmn->cpu = target;
  1165          return 0;
  1166  }

regards,
dan carpenter

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2020-09-30 14:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-30 14:34 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-09-30 14:36 [bug report] perf: Add Arm CMN-600 PMU driver Dan Carpenter

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=20200930143444.GA651504@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=robin.murphy@arm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.