diff mbox series

crypto: lib/mpi - Fix an "Uninitialized scalar variable" issue

Message ID 20240913140741.5944-1-qianqiang.liu@163.com
State Accepted
Commit cd843399d706411ff80520fb7883afeeefa76e98
Headers show
Series crypto: lib/mpi - Fix an "Uninitialized scalar variable" issue | expand

Commit Message

Qianqiang Liu Sept. 13, 2024, 2:07 p.m. UTC
The "err" variable may be returned without an initialized value.

Fixes: 8e3a67f2de87 ("crypto: lib/mpi - Add error checks to extension")
Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com>
---
 lib/crypto/mpi/mpi-mul.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Herbert Xu Oct. 5, 2024, 5:31 a.m. UTC | #1
On Sat, Sep 14, 2024 at 08:53:30AM +0800, Qianqiang Liu wrote:
> On Fri, Sep 13, 2024 at 10:07:42PM +0800, Qianqiang Liu wrote:
> > The "err" variable may be returned without an initialized value.
> > 
> > Fixes: 8e3a67f2de87 ("crypto: lib/mpi - Add error checks to extension")
> > Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com>
> > ---
> >  lib/crypto/mpi/mpi-mul.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/lib/crypto/mpi/mpi-mul.c b/lib/crypto/mpi/mpi-mul.c
> > index 892a246216b9..7e6ff1ce3e9b 100644
> > --- a/lib/crypto/mpi/mpi-mul.c
> > +++ b/lib/crypto/mpi/mpi-mul.c
> > @@ -21,7 +21,7 @@ int mpi_mul(MPI w, MPI u, MPI v)
> >  	int usign, vsign, sign_product;
> >  	int assign_wp = 0;
> >  	mpi_ptr_t tmp_limb = NULL;
> > -	int err;
> > +	int err = 0;
> >  
> >  	if (u->nlimbs < v->nlimbs) {
> >  		/* Swap U and V. */
> > -- 
> > 2.34.1
> 
> Could you please review this patch?

Patch applied.  Thanks.
diff mbox series

Patch

diff --git a/lib/crypto/mpi/mpi-mul.c b/lib/crypto/mpi/mpi-mul.c
index 892a246216b9..7e6ff1ce3e9b 100644
--- a/lib/crypto/mpi/mpi-mul.c
+++ b/lib/crypto/mpi/mpi-mul.c
@@ -21,7 +21,7 @@  int mpi_mul(MPI w, MPI u, MPI v)
 	int usign, vsign, sign_product;
 	int assign_wp = 0;
 	mpi_ptr_t tmp_limb = NULL;
-	int err;
+	int err = 0;
 
 	if (u->nlimbs < v->nlimbs) {
 		/* Swap U and V. */