lkml.org 
[lkml]   [2020]   [May]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH V2 3/3] perf/x86/intel/uncore: Validate MMIO address before accessing
From
Date


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)
>

\
 
 \ /
  Last update: 2020-05-28 15:49    [W:0.644 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site