[bug report] lib/mpi: Extend the MPI library

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Tianjia Zhang,

The patch a8ea8bdd9df9: "lib/mpi: Extend the MPI library" from Sep
21, 2020 (linux-next), leads to the following Smatch static checker
warning:

	lib/crypto/mpi/mpi-mul.c:75 mpi_mul()
	error: uninitialized symbol 'cy'.

lib/crypto/mpi/mpi-mul.c
    65                         vp = tmp_limb = mpi_alloc_limb_space(vsize);
    66                         /* Copy to the temporary space.  */
    67                         MPN_COPY(vp, wp, vsize);
    68                 }
    69         }
    70 
    71         if (!vsize)
    72                 wsize = 0;
    73         else {
    74                 mpihelp_mul(wp, up, usize, vp, vsize, &cy);

Herbert moved files around so we're re-visiting old warnings today.
The mpihelp_mul() function can fail with -ENOMEM.  Should we check for
that?

--> 75                 wsize -= cy ? 0:1;
    76         }
    77 
    78         if (assign_wp)
    79                 mpi_assign_limb_space(w, wp, wsize);
    80         w->nlimbs = wsize;
    81         w->sign = sign_product;
    82         if (tmp_limb)
    83                 mpi_free_limb_space(tmp_limb);
    84 }

regards,
dan carpenter



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux