lkml.org 
[lkml]   [2020]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v3 3/6] powerpc/fsl_booke/64: implement KASLR for fsl_booke64
From
Date


Le 26/02/2020 à 03:40, Jason Yan a écrit :
>
>
> 在 2020/2/20 21:48, Christophe Leroy 写道:
>>
>>
>> Le 06/02/2020 à 03:58, Jason Yan a écrit :
>>>       /*
>>>        * Decide which 64M we want to start
>>>        * Only use the low 8 bits of the random seed
>>>        */
>>> -    index = random & 0xFF;
>>> +    unsigned long index = random & 0xFF;
>>
>> That's not good in terms of readability, index declaration should
>> remain at the top of the function, should be possible if using
>> IS_ENABLED() instead
>
> I'm wondering how to declare a variable inside a code block such as if
> (IS_ENABLED(CONFIG_PPC32)) at the top of the function and use the
> variable in another if (IS_ENABLED(CONFIG_PPC32)). Is there any good idea?

You declare it outside the block as usual:

unsigned long some_var;

if (condition) {
some_var = something;
}
do_many_things();
do_other_things();

if (condition)
return some_var;
else
return 0;


Christophe

\
 
 \ /
  Last update: 2020-02-26 06:09    [W:0.077 / U:2.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site