答复: [PATCH 01/11] Initialize the mapping of KASan shadow memory

Liuwenliang (Abbott Liu) liuwenliang at huawei.com
Sun Nov 26 17:26:32 PST 2017


On Nov 23, 2017  23:32  Mark Rutland [mailto:mark.rutland at arm.com] wrote:
>On Wed, Nov 22, 2017 at 12:56:44PM +0000, Liuwenliang (Abbott Liu) wrote:
>> +static inline u64 get_ttbr0(void)
>> +{
>> + if (IS_ENABLED(CONFIG_ARM_LPAE))
>> +         return read_sysreg(TTBR0_64);
>> + else
>> +         return (u64)read_sysreg(TTBR0_32);
>> +}
>
>> +static inline u64 get_ttbr1(void)
>> +{
>> + if (IS_ENABLED(CONFIG_ARM_LPAE))
>> +         return read_sysreg(TTBR1_64);
>> + else
>> +         return (u64)read_sysreg(TTBR1_32);
>> +}
>
>In addition to the whitespace damage that need to be fixed, there's no
>need for the u64 casts here. The compiler will implicitly cast to the
>return type, and as u32 and u64 are both arithmetic types, we don't need
>an explicit cast here.

Thanks for your review.
I'm going to change it in the new version.  


-----邮件原件-----
发件人: Mark Rutland [mailto:mark.rutland at arm.com] 
发送时间: 2017年11月23日 23:32
收件人: Liuwenliang (Abbott Liu)
抄送: Marc Zyngier; tixy at linaro.org; mhocko at suse.com; grygorii.strashko at linaro.org; catalin.marinas at arm.com; linux-mm at kvack.org; glider at google.com; afzal.mohd.ma at gmail.com; mingo at kernel.org; Christoffer Dall; f.fainelli at gmail.com; mawilcox at microsoft.com; linux at armlinux.org.uk; kasan-dev at googlegroups.com; Dailei; linux-arm-kernel at lists.infradead.org; aryabinin at virtuozzo.com; labbott at redhat.com; vladimir.murzin at arm.com; keescook at chromium.org; arnd at arndb.de; Zengweilin; opendmb at gmail.com; Heshaoliang; tglx at linutronix.de; dvyukov at google.com; ard.biesheuvel at linaro.org; linux-kernel at vger.kernel.org; Jiazhenghua; akpm at linux-foundation.org; robin.murphy at arm.com; thgarnie at google.com; kirill.shutemov at linux.intel.com
主题: Re: [PATCH 01/11] Initialize the mapping of KASan shadow memory

On Wed, Nov 22, 2017 at 12:56:44PM +0000, Liuwenliang (Abbott Liu) wrote:
> +static inline u64 get_ttbr0(void)
> +{
> + if (IS_ENABLED(CONFIG_ARM_LPAE))
> +         return read_sysreg(TTBR0_64);
> + else
> +         return (u64)read_sysreg(TTBR0_32);
> +}

> +static inline u64 get_ttbr1(void)
> +{
> + if (IS_ENABLED(CONFIG_ARM_LPAE))
> +         return read_sysreg(TTBR1_64);
> + else
> +         return (u64)read_sysreg(TTBR1_32);
> +}

In addition to the whitespace damage that need to be fixed, there's no
need for the u64 casts here. The compiler will implicitly cast to the
return type, and as u32 and u64 are both arithmetic types, we don't need
an explicit cast here.

Thanks,
Mark.


More information about the linux-arm-kernel mailing list