lkml.org 
[lkml]   [2017]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 4/6] hw_breakpoint: Factor out __modify_user_hw_breakpoint function
On Mon, Nov 27, 2017 at 2:01 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Mon, Nov 27, 2017 at 01:50:30PM -0800, Milind Chabbi wrote:
>> The possible checks is infinite
>
> struct perf_event_attr is very much a finite data type.
>
> Something as simple as:
>
> struct perf_event_attr tmp1 = new_attr, tmp2 = event->attr;
>
> tmp1.bp_type = tmp2.bp_type;
> tmp1.bp_addr = tmp2.bp_addr;
> tmp1.bp_len = tmp2.bp_len;
>
> if (memcmp(&tmp1, &tmp2, sizeof(tmp1)))
> return -EINVAL;
>
> would actually do the checks __modify_user_hw_breakpoint() needs to do.

Ok. That seems like a slick idea. I will post a patch that does this.

\
 
 \ /
  Last update: 2017-11-27 23:17    [W:0.075 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site