From: "Liang, Kan" <kan.liang@linux.intel.com>
To: David Laight <David.Laight@ACULAB.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 09:49:16 -0400 [thread overview]
Message-ID: <79403443-e893-da26-ee6d-1fd7f252bbfe@linux.intel.com> (raw)
In-Reply-To: <de3b847eddd143998997d70a1ba161b8@AcuMS.aculab.com>
On 5/28/2020 9:33 AM, David Laight wrote:
> 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.
>
Sure
>> +{
>> + 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;
>
Sure
>> +
>> + pr_warn_once("perf uncore: Access invalid address of %s.\n",
>> + box->pmu->type->name);
>
> Pretty hard to debug without the invalid offset.
>
I will dump the box->io_addr and offset for debugging.
Thanks,
Kan
> 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:49 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
2020-05-28 13:49 ` Liang, Kan [this message]
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=79403443-e893-da26-ee6d-1fd7f252bbfe@linux.intel.com \
--to=kan.liang@linux.intel.com \
--cc=David.Laight@ACULAB.COM \
--cc=ak@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