[PATCH] powerpc/sstep: Avoid used uninitialized error

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE3284d

2 messages, 2 authors, 2017-09-06 · open the first message on its own page

[PATCH] powerpc/sstep: Avoid used uninitialized error

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2017-09-01 22:03:53

Older compilers think val may be used uninitialized:

  arch/powerpc/lib/sstep.c: In function 'emulate_loadstore':
  arch/powerpc/lib/sstep.c:2758:23: error: 'val' may be used uninitialized in this function

We know better, but initialise val to 0 to avoid breaking the build.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/lib/sstep.c | 1 +
 1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index 06dd61d8d48b..fb9f58b868e7 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -2727,6 +2727,7 @@ int emulate_loadstore(struct pt_regs *regs, struct instruction_op *op)
 		if (!address_ok(regs, ea, size))
 			return -EFAULT;
 		err = 0;
+		val = 0;
 		switch (size) {
 #ifdef __powerpc64__
 		case 1:
-- 
2.7.4

Re: powerpc/sstep: Avoid used uninitialized error

From: Michael Ellerman <hidden>
Date: 2017-09-06 10:55:25

On Fri, 2017-09-01 at 22:03:44 UTC, Michael Ellerman wrote:
Older compilers think val may be used uninitialized:

  arch/powerpc/lib/sstep.c: In function 'emulate_loadstore':
  arch/powerpc/lib/sstep.c:2758:23: error: 'val' may be used uninitialized in this function

We know better, but initialise val to 0 to avoid breaking the build.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Applied to powerpc next.

https://git.kernel.org/powerpc/c/3b79b26101936bbdb7a5c69161c69d

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help