[PATCH v2 2/3] drm: simplify authentication management
David Herrmann
dh.herrmann at gmail.com
Mon May 4 11:37:07 PDT 2015
Hi
On Mon, May 4, 2015 at 8:33 PM, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> 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.
...my bad. I thought you were talking about the off-by-one. I actually
thought drm_magic_t might be 64bit under some circumstances, so I
wanted to avoid the double-mapping. But you're right, it's just an
unsigned int so we can forward it unchanged to the idr helpers.
Fixed!
Thanks
David
> 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