Subject: Re: [v2, 1/2] powerpc/64s: Fix logic when handling unknown CPU features

From: Michael Ellerman <[email-masked]>
Date: Fri, 22 Feb 2019 20:47:51 +1100 (AEDT)

On Mon, 2019-02-11 at 00:20:01 UTC, Andrew Donnellan wrote:
> From: Michael Ellerman <[email-masked]>
> 
> In cpufeatures_process_feature(), if a provided CPU feature is unknown and
> enable_unknown is false, we erroneously print that the feature is being
> enabled and return true, even though no feature has been enabled, and
> may also set feature bits based on the last entry in the match table.
> 
> Fix this so that we only set feature bits from the match table if we have
> actually enabled a feature from that table, and when failing to enable an
> unknown feature, always print the "not enabling" message and return false.
> 
> Coincidentally, some older gccs (<GCC 7), when invoked with
> -fsanitize-coverage=trace-pc, cause a spurious uninitialised variable
> warning in this function:
> 
>   arch/powerpc/kernel/dt_cpu_ftrs.c: In function âcpufeatures_process_featureâ:
>   arch/powerpc/kernel/dt_cpu_ftrs.c:686:7: warning: âmâ may be used uninitialized in this function [-Wmaybe-uninitialized]
>     if (m->cpu_ftr_bit_mask)
> 
> An upcoming patch will enable support for kcov, which requires this option.
> This patch avoids the warning.
> 
> Fixes: 5a61ef74f269 ("powerpc/64s: Support new device tree binding for discovering CPU features")
> Reported-by: Segher Boessenkool <[email-masked]>
> Signed-off-by: Michael Ellerman <[email-masked]>
> [ajd: add commit message]
> Signed-off-by: Andrew Donnellan <[email-masked]>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/8cfaf106918a8c13abb24c641556172a

cheers