[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <4496VZ4JGRz9s9L@ozlabs.org>
Date: Thu, 28 Feb 2019 20:21:10 +1100 (AEDT)
From: Michael Ellerman <patch-notifications@...erman.id.au>
To: Nathan Chancellor <natechancellor@...il.com>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>
Cc: Nick Desaulniers <ndesaulniers@...gle.com>,
Nathan Chancellor <natechancellor@...il.com>,
linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org,
Joel Stanley <joel@....id.au>
Subject: Re: powerpc/xmon: Fix opcode being uninitialized in print_insn_powerpc
On Tue, 2019-02-26 at 05:38:55 UTC, Nathan Chancellor wrote:
> When building with -Wsometimes-uninitialized, Clang warns:
>
> arch/powerpc/xmon/ppc-dis.c:157:7: warning: variable 'opcode' is used
> uninitialized whenever 'if' condition is false
> [-Wsometimes-uninitialized]
> if (cpu_has_feature(CPU_FTRS_POWER9))
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> arch/powerpc/xmon/ppc-dis.c:167:7: note: uninitialized use occurs here
> if (opcode == NULL)
> ^~~~~~
> arch/powerpc/xmon/ppc-dis.c:157:3: note: remove the 'if' if its
> condition is always true
> if (cpu_has_feature(CPU_FTRS_POWER9))
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> arch/powerpc/xmon/ppc-dis.c:132:38: note: initialize the variable
> 'opcode' to silence this warning
> const struct powerpc_opcode *opcode;
> ^
> = NULL
> 1 warning generated.
>
> This warning seems to make no sense on the surface because opcode is set
> to NULL right below this statement. However, there is a comma instead of
> semicolon to end the dialect assignment, meaning that the opcode
> assignment only happens in the if statement. Properly terminate that
> line so that Clang no longer warns.
>
> Fixes: 5b102782c7f4 ("powerpc/xmon: Enable disassembly files (compilation changes)")
> Link: https://github.com/ClangBuiltLinux/linux/issues/390
> Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
> Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/e7140639b1de65bba435a6bd772d1349
cheers
Powered by blists - more mailing lists