diff options
| author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-02-21 09:32:19 +0200 | 
|---|---|---|
| committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2012-02-21 09:32:19 +0200 | 
| commit | 3f60db4bde17088feed5f143582d7661cdbb9a01 (patch) | |
| tree | 21a7866ae6d199cfa8f619ced9500687bdf84f18 /lib/mpi/mpi-div.c | |
| parent | 5e36097889725dbe4f098c3f1e93cb2f21cae6ee (diff) | |
| parent | b01543dfe67bb1d191998e90d20534dc354de059 (diff) | |
Merge commit 'v3.3-rc4'
Diffstat (limited to 'lib/mpi/mpi-div.c')
| -rw-r--r-- | lib/mpi/mpi-div.c | 5 | 
1 files changed, 5 insertions, 0 deletions
| diff --git a/lib/mpi/mpi-div.c b/lib/mpi/mpi-div.c index c3087d1390c..f68cbbb4d4a 100644 --- a/lib/mpi/mpi-div.c +++ b/lib/mpi/mpi-div.c @@ -149,6 +149,9 @@ int mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den)  	mpi_ptr_t marker[5];  	int markidx = 0; +	if (!dsize) +		return -EINVAL; +  	memset(marker, 0, sizeof(marker));  	/* Ensure space is enough for quotient and remainder. @@ -207,6 +210,8 @@ int mpi_tdiv_qr(MPI quot, MPI rem, MPI num, MPI den)  		 * numerator would be gradually overwritten by the quotient limbs.  */  		if (qp == np) {	/* Copy NP object to temporary space.  */  			np = marker[markidx++] = mpi_alloc_limb_space(nsize); +			if (!np) +				goto nomem;  			MPN_COPY(np, qp, nsize);  		}  	} else			/* Put quotient at top of remainder. */ | 
