* [PATCH] powerpc/process: Fix uninitialised variable error
@ 2020-09-17 2:45 Michael Ellerman
2020-09-18 1:34 ` Nick Desaulniers
2020-09-24 12:29 ` Michael Ellerman
0 siblings, 2 replies; 3+ messages in thread
From: Michael Ellerman @ 2020-09-17 2:45 UTC (permalink / raw)
To: linuxppc-dev
Clang, and GCC with -Wmaybe-uninitialized, can't see that val is
unused in get_fpexec_mode():
arch/powerpc/kernel/process.c:1940:7: error: variable 'val' is used
uninitialized whenever 'if' condition is true
if (cpu_has_feature(CPU_FTR_SPE)) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
We know that CPU_FTR_SPE will only be true iff CONFIG_SPE is also
true, but the compiler doesn't.
Avoid it by initialising val to zero.
Reported-by: kernel test robot <lkp@intel.com>
Fixes: 532ed1900d37 ("powerpc/process: Remove useless #ifdef CONFIG_SPE")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/kernel/process.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 14d5189b17d8..d421a2c7f822 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1934,7 +1934,7 @@ int set_fpexc_mode(struct task_struct *tsk, unsigned int val)
int get_fpexc_mode(struct task_struct *tsk, unsigned long adr)
{
- unsigned int val;
+ unsigned int val = 0;
if (tsk->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE) {
if (cpu_has_feature(CPU_FTR_SPE)) {
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/process: Fix uninitialised variable error
2020-09-17 2:45 [PATCH] powerpc/process: Fix uninitialised variable error Michael Ellerman
@ 2020-09-18 1:34 ` Nick Desaulniers
2020-09-24 12:29 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Nick Desaulniers @ 2020-09-18 1:34 UTC (permalink / raw)
To: mpe; +Cc: linuxppc-dev, Nick Desaulniers, clang-built-linux
https://lore.kernel.org/linuxppc-dev/20200917024509.3253837-1-mpe@ellerman.id.au/
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Tested-by: Nick Desaulniers <ndesaulniers@google.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc/process: Fix uninitialised variable error
2020-09-17 2:45 [PATCH] powerpc/process: Fix uninitialised variable error Michael Ellerman
2020-09-18 1:34 ` Nick Desaulniers
@ 2020-09-24 12:29 ` Michael Ellerman
1 sibling, 0 replies; 3+ messages in thread
From: Michael Ellerman @ 2020-09-24 12:29 UTC (permalink / raw)
To: Michael Ellerman, linuxppc-dev
On Thu, 17 Sep 2020 12:45:09 +1000, Michael Ellerman wrote:
> Clang, and GCC with -Wmaybe-uninitialized, can't see that val is
> unused in get_fpexec_mode():
>
> arch/powerpc/kernel/process.c:1940:7: error: variable 'val' is used
> uninitialized whenever 'if' condition is true
> if (cpu_has_feature(CPU_FTR_SPE)) {
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> [...]
Applied to powerpc/next.
[1/1] powerpc/process: Fix uninitialised variable error
https://git.kernel.org/powerpc/c/d208e13c6a2277d9fb71fad6a1394c70bdd7b634
cheers
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-24 13:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 2:45 [PATCH] powerpc/process: Fix uninitialised variable error Michael Ellerman
2020-09-18 1:34 ` Nick Desaulniers
2020-09-24 12:29 ` Michael Ellerman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.