[PATCH v2 2/3] drm: simplify authentication management

Chris Wilson chris at chris-wilson.co.uk
Mon May 4 11:33:02 PDT 2015


On Mon, May 04, 2015 at 08:19:33PM +0200, David Herrmann wrote:
> The magic auth tokens we have are a simple map from cyclic IDs to drm_file
> objects. Remove all the old bulk of code and replace it with a simple,
> direct IDR.
> 
> The previous behavior is kept. Especially calling authmagic multiple times
> on the same magic results in EINVAL except on the first call. The only
> difference in behavior is that we never allocate IDs multiple times as
> long as a client has its FD open.
> 
> Diff-stat:
>    5 files changed, 45 insertions(+), 157 deletions(-)
> 
> Signed-off-by: David Herrmann <dh.herrmann at gmail.com>
> ---
> v2:
>  - Fix return code of GetMagic()
>  - Use non-cyclic IDR allocator
>  - fix off-by-one in "magic > INT_MAX" sanity check

I'm being nitpicking because I don't understand the rationale for doing
the range check ourselves. idr_find() will return NULL quite happily if
the id wraps around to negative.

However, that's a nit and I like its simplicity (or at least hiding the
complexity in widely used lib code!),

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the dri-devel mailing list