LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] padata: fix uninitialized return value in padata_replace()
@ 2020-02-10 18:11 Daniel Jordan
  2020-02-22  1:41 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Jordan @ 2020-02-10 18:11 UTC (permalink / raw)
  To: Herbert Xu, Steffen Klassert
  Cc: Daniel Jordan, Geert Uytterhoeven, linux-crypto, linux-kernel

According to Geert's report[0],

  kernel/padata.c: warning: 'err' may be used uninitialized in this
    function [-Wuninitialized]:  => 539:2

Warning is seen only with older compilers on certain archs.  The
runtime effect is potentially returning garbage down the stack when
padata's cpumasks are modified before any pcrypt requests have run.

Simplest fix is to initialize err to the success value.

[0] http://lkml.kernel.org/r/20200210135506.11536-1-geert@linux-m68k.org

Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Fixes: bbefa1dd6a6d ("crypto: pcrypt - Avoid deadlock by using per-instance padata queues")
Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: linux-crypto@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
 kernel/padata.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/padata.c b/kernel/padata.c
index 72777c10bb9c..62082597d4a2 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -512,7 +512,7 @@ static int padata_replace_one(struct padata_shell *ps)
 static int padata_replace(struct padata_instance *pinst)
 {
 	struct padata_shell *ps;
-	int err;
+	int err = 0;
 
 	pinst->flags |= PADATA_RESET;
 
-- 
2.24.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] padata: fix uninitialized return value in padata_replace()
  2020-02-10 18:11 [PATCH] padata: fix uninitialized return value in padata_replace() Daniel Jordan
@ 2020-02-22  1:41 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2020-02-22  1:41 UTC (permalink / raw)
  To: Daniel Jordan
  Cc: Steffen Klassert, Geert Uytterhoeven, linux-crypto, linux-kernel

On Mon, Feb 10, 2020 at 01:11:00PM -0500, Daniel Jordan wrote:
> According to Geert's report[0],
> 
>   kernel/padata.c: warning: 'err' may be used uninitialized in this
>     function [-Wuninitialized]:  => 539:2
> 
> Warning is seen only with older compilers on certain archs.  The
> runtime effect is potentially returning garbage down the stack when
> padata's cpumasks are modified before any pcrypt requests have run.
> 
> Simplest fix is to initialize err to the success value.
> 
> [0] http://lkml.kernel.org/r/20200210135506.11536-1-geert@linux-m68k.org
> 
> Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
> Fixes: bbefa1dd6a6d ("crypto: pcrypt - Avoid deadlock by using per-instance padata queues")
> Signed-off-by: Daniel Jordan <daniel.m.jordan@oracle.com>
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Cc: Steffen Klassert <steffen.klassert@secunet.com>
> Cc: linux-crypto@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> ---
>  kernel/padata.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-22  1:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-10 18:11 [PATCH] padata: fix uninitialized return value in padata_replace() Daniel Jordan
2020-02-22  1:41 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).