lkml.org 
[lkml]   [2018]   [Sep]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf: enum overflow in uapi/linux/perf_event.h
On Fri, Sep 07, 2018 at 04:15:33PM +0200, Christophe LEROY wrote:

> Ah yes, it seems that GCC is happy. So sparse should be fixed instead ?

Ideally, yes.

> Anyway, is it really correct to put this constant inside that enum, after
> PERF_SAMPLE_MAX ?

It is a bit of a hack, agreed. What we do is use the top bit of that
word (u64) for some internal state. By placing it there (after MAX) we
ensure it is not available for userspace (trying to set it will return
in -EINVAL) and by keeping it in the enum we know that bit is
unavailable for future use.

I have a patch queued that puts a little comment on that:

https://git.kernel.org/pub/scm/linux/kernel/git/peterz/queue.git/commit/?h=perf/urgent&id=34cad593c9ea350a1811ab718e64b36e5cde870c

(url is not stable, as I regenerate that git tree from quilt every so
often, but it should probably last the day).

\
 
 \ /
  Last update: 2018-09-07 16:24    [W:0.044 / U:0.376 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site