lkml.org 
[lkml]   [2011]   [Nov]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/4] Routine for generating an safe ID for kernel pointer
>> +unsigned long gen_object_id(void *ptr)
>> +{
>> + if (!ptr)
>> + return 0;
>> +
>> + if (unlikely(!ptr_poison)) {
>> + spin_lock(&ptr_poison_lock);
>> + if (!ptr_poison)
>> + get_random_bytes(&ptr_poison, sizeof(ptr_poison));
>> + spin_unlock(&ptr_poison_lock);
>> + }
>> +
>> + return ((unsigned long)ptr) ^ ptr_poison;
>> +}
>
> You could put this in mm/util.c. Wouldn't it make sense to separate
> the initialization and use late_initcall() to call it?

OK, will put to util.c

About the initialization - I will put the sanity check about poison being not 0 on
get_object_id() anyway, so what's the point in separate initialization?

> Pekka
> .
>



\
 
 \ /
  Last update: 2011-11-15 12:47    [W:0.048 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site