Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43b2c0ae authored by Dmitry Kasatkin's avatar Dmitry Kasatkin Committed by James Morris
Browse files

lib/mpi: added missing NULL check



Added missing NULL check after mpi_alloc_limb_space().

Signed-off-by: default avatarDmitry Kasatkin <dmitry.kasatkin@intel.com>
Reviewed-by: default avatarTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: default avatarJames Morris <jmorris@namei.org>
parent a6d68ecc
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -210,6 +210,8 @@ int mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den)
		 * numerator would be gradually overwritten by the quotient limbs.  */
		 * numerator would be gradually overwritten by the quotient limbs.  */
		if (qp == np) {	/* Copy NP object to temporary space.  */
		if (qp == np) {	/* Copy NP object to temporary space.  */
			np = marker[markidx++] = mpi_alloc_limb_space(nsize);
			np = marker[markidx++] = mpi_alloc_limb_space(nsize);
			if (!np)
				goto nomem;
			MPN_COPY(np, qp, nsize);
			MPN_COPY(np, qp, nsize);
		}
		}
	} else			/* Put quotient at top of remainder. */
	} else			/* Put quotient at top of remainder. */