* [PATCH] powerpc: Always initialize input array when calling epapr_hypercall()
@ 2017-09-28 13:33 Seth Forshee
2017-10-08 8:43 ` Michael Ellerman
0 siblings, 1 reply; 2+ messages in thread
From: Seth Forshee @ 2017-09-28 13:33 UTC (permalink / raw)
To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
Cc: Seth Forshee, linuxppc-dev, linux-kernel
Several callers to epapr_hypercall() pass an uninitialized stack
allocated array for the input arguments, presumably because they
have no input arguments. However this can produce errors like
this one
arch/powerpc/include/asm/epapr_hcalls.h:470:42: error: 'in' may be used uninitialized in this function [-Werror=maybe-uninitialized]
unsigned long register r3 asm("r3") = in[0];
~~^~~
Fix callers to this function to always zero-initialize the input
arguments array to prevent this.
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
arch/powerpc/include/asm/epapr_hcalls.h | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/powerpc/include/asm/epapr_hcalls.h b/arch/powerpc/include/asm/epapr_hcalls.h
index 334459ad145b..90863245df53 100644
--- a/arch/powerpc/include/asm/epapr_hcalls.h
+++ b/arch/powerpc/include/asm/epapr_hcalls.h
@@ -508,7 +508,7 @@ static unsigned long epapr_hypercall(unsigned long *in,
static inline long epapr_hypercall0_1(unsigned int nr, unsigned long *r2)
{
- unsigned long in[8];
+ unsigned long in[8] = {0};
unsigned long out[8];
unsigned long r;
@@ -520,7 +520,7 @@ static inline long epapr_hypercall0_1(unsigned int nr, unsigned long *r2)
static inline long epapr_hypercall0(unsigned int nr)
{
- unsigned long in[8];
+ unsigned long in[8] = {0};
unsigned long out[8];
return epapr_hypercall(in, out, nr);
@@ -528,7 +528,7 @@ static inline long epapr_hypercall0(unsigned int nr)
static inline long epapr_hypercall1(unsigned int nr, unsigned long p1)
{
- unsigned long in[8];
+ unsigned long in[8] = {0};
unsigned long out[8];
in[0] = p1;
@@ -538,7 +538,7 @@ static inline long epapr_hypercall1(unsigned int nr, unsigned long p1)
static inline long epapr_hypercall2(unsigned int nr, unsigned long p1,
unsigned long p2)
{
- unsigned long in[8];
+ unsigned long in[8] = {0};
unsigned long out[8];
in[0] = p1;
@@ -549,7 +549,7 @@ static inline long epapr_hypercall2(unsigned int nr, unsigned long p1,
static inline long epapr_hypercall3(unsigned int nr, unsigned long p1,
unsigned long p2, unsigned long p3)
{
- unsigned long in[8];
+ unsigned long in[8] = {0};
unsigned long out[8];
in[0] = p1;
@@ -562,7 +562,7 @@ static inline long epapr_hypercall4(unsigned int nr, unsigned long p1,
unsigned long p2, unsigned long p3,
unsigned long p4)
{
- unsigned long in[8];
+ unsigned long in[8] = {0};
unsigned long out[8];
in[0] = p1;
--
2.14.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: powerpc: Always initialize input array when calling epapr_hypercall()
2017-09-28 13:33 [PATCH] powerpc: Always initialize input array when calling epapr_hypercall() Seth Forshee
@ 2017-10-08 8:43 ` Michael Ellerman
0 siblings, 0 replies; 2+ messages in thread
From: Michael Ellerman @ 2017-10-08 8:43 UTC (permalink / raw)
To: Seth Forshee, Benjamin Herrenschmidt, Paul Mackerras
Cc: Seth Forshee, linuxppc-dev, linux-kernel
On Thu, 2017-09-28 at 13:33:39 UTC, Seth Forshee wrote:
> Several callers to epapr_hypercall() pass an uninitialized stack
> allocated array for the input arguments, presumably because they
> have no input arguments. However this can produce errors like
> this one
>
> arch/powerpc/include/asm/epapr_hcalls.h:470:42: error: 'in' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> unsigned long register r3 asm("r3") = in[0];
> ~~^~~
>
> Fix callers to this function to always zero-initialize the input
> arguments array to prevent this.
>
> Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/186b8f1587c79c2fa04bfa392fdf08
cheers
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-10-08 8:43 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-28 13:33 [PATCH] powerpc: Always initialize input array when calling epapr_hypercall() Seth Forshee
2017-10-08 8:43 ` 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.