From: David Laight <David.Laight@ACULAB.COM>
To: "'kan.liang@linux.intel.com'" <kan.liang@linux.intel.com>,
"peterz@infradead.org" <peterz@infradead.org>,
"mingo@redhat.com" <mingo@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "ak@linux.intel.com" <ak@linux.intel.com>
Subject: RE: [PATCH V2 3/3] perf/x86/intel/uncore: Validate MMIO address before accessing
Date: Thu, 28 May 2020 13:33:00 +0000 [thread overview]
Message-ID: <de3b847eddd143998997d70a1ba161b8@AcuMS.aculab.com> (raw)
In-Reply-To: <1590671727-99311-3-git-send-email-kan.liang@linux.intel.com>
From: kan.liang@linux.intel.com
> Sent: 28 May 2020 14:15
...
> +static inline bool is_valid_mmio_offset(struct intel_uncore_box *box,
> + unsigned long offset)
You need a better name, needs to start 'uncore_' and 'mmio'
probably isn't right either.
> +{
> + if (box->pmu->type->mmio_map_size > offset)
> + return true;
Swap over.
Conditionals always read best if 'variable op constant'.
So you want:
if (offset < box->pmu->type->mmio_map_size)
return true;
> +
> + pr_warn_once("perf uncore: Access invalid address of %s.\n",
> + box->pmu->type->name);
Pretty hard to debug without the invalid offset.
I've no idea what the code is supposed to be doing though.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2020-05-28 13:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-28 13:15 [PATCH V2 1/3] perf/x86/intel/uncore: Fix oops when counting IMC uncore events on some TGL kan.liang
2020-05-28 13:15 ` [PATCH V2 2/3] perf/x86/intel/uncore: Record the size of mapped area kan.liang
2020-05-28 13:29 ` Andi Kleen
2020-05-28 13:44 ` Liang, Kan
2020-05-28 13:15 ` [PATCH V2 3/3] perf/x86/intel/uncore: Validate MMIO address before accessing kan.liang
2020-05-28 13:30 ` Andi Kleen
2020-05-28 13:46 ` Liang, Kan
2020-05-28 13:33 ` David Laight [this message]
2020-05-28 13:49 ` Liang, Kan
2020-05-28 14:02 ` Andi Kleen
2020-05-28 14:08 ` Liang, Kan
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=de3b847eddd143998997d70a1ba161b8@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=ak@linux.intel.com \
--cc=kan.liang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.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).