]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/powerpc-xmon-fix-opcode-being-uninitialized-in-print.patch
9f08a3daea5e516c085a8cad8c396cc59eaaa379
[thirdparty/kernel/stable-queue.git] / queue-4.19 / powerpc-xmon-fix-opcode-being-uninitialized-in-print.patch
1 From 3405de2d79b9c33ae5b60280b906a50c48b6199f Mon Sep 17 00:00:00 2001
2 From: Nathan Chancellor <natechancellor@gmail.com>
3 Date: Mon, 25 Feb 2019 22:38:55 -0700
4 Subject: powerpc/xmon: Fix opcode being uninitialized in print_insn_powerpc
5
6 [ Upstream commit e7140639b1de65bba435a6bd772d134901141f86 ]
7
8 When building with -Wsometimes-uninitialized, Clang warns:
9
10 arch/powerpc/xmon/ppc-dis.c:157:7: warning: variable 'opcode' is used
11 uninitialized whenever 'if' condition is false
12 [-Wsometimes-uninitialized]
13 if (cpu_has_feature(CPU_FTRS_POWER9))
14 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 arch/powerpc/xmon/ppc-dis.c:167:7: note: uninitialized use occurs here
16 if (opcode == NULL)
17 ^~~~~~
18 arch/powerpc/xmon/ppc-dis.c:157:3: note: remove the 'if' if its
19 condition is always true
20 if (cpu_has_feature(CPU_FTRS_POWER9))
21 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 arch/powerpc/xmon/ppc-dis.c:132:38: note: initialize the variable
23 'opcode' to silence this warning
24 const struct powerpc_opcode *opcode;
25 ^
26 = NULL
27 1 warning generated.
28
29 This warning seems to make no sense on the surface because opcode is set
30 to NULL right below this statement. However, there is a comma instead of
31 semicolon to end the dialect assignment, meaning that the opcode
32 assignment only happens in the if statement. Properly terminate that
33 line so that Clang no longer warns.
34
35 Fixes: 5b102782c7f4 ("powerpc/xmon: Enable disassembly files (compilation changes)")
36 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
37 Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
38 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
39 Signed-off-by: Sasha Levin <sashal@kernel.org>
40 ---
41 arch/powerpc/xmon/ppc-dis.c | 2 +-
42 1 file changed, 1 insertion(+), 1 deletion(-)
43
44 diff --git a/arch/powerpc/xmon/ppc-dis.c b/arch/powerpc/xmon/ppc-dis.c
45 index 9deea5ee13f6..27f1e6415036 100644
46 --- a/arch/powerpc/xmon/ppc-dis.c
47 +++ b/arch/powerpc/xmon/ppc-dis.c
48 @@ -158,7 +158,7 @@ int print_insn_powerpc (unsigned long insn, unsigned long memaddr)
49 dialect |= (PPC_OPCODE_POWER5 | PPC_OPCODE_POWER6 | PPC_OPCODE_POWER7
50 | PPC_OPCODE_POWER8 | PPC_OPCODE_POWER9 | PPC_OPCODE_HTM
51 | PPC_OPCODE_ALTIVEC | PPC_OPCODE_ALTIVEC2
52 - | PPC_OPCODE_VSX | PPC_OPCODE_VSX3),
53 + | PPC_OPCODE_VSX | PPC_OPCODE_VSX3);
54
55 /* Get the major opcode of the insn. */
56 opcode = NULL;
57 --
58 2.19.1
59