Re: [PATCH v3 3/6] powerpc/fsl_booke/64: implement KASLR for fsl_booke64
From: Christophe Leroy
Date: Wed Feb 26 2020 - 00:08:23 EST
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