lkml.org 
[lkml]   [2016]   [Nov]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/2] MPI: Fix mpi_powm() when exponent is 0 and the result has no limbs
2016-11-24 14:17 GMT+03:00 David Howells <dhowells@redhat.com>:
> David Howells <dhowells@redhat.com> wrote:
>
>> + if (!rp) {
>> + if (mpi_resize(res, 1) < 0)
>
> This is better done with RESIZE_IF_NEEDED().
>

mpi_resize() is equal to RESIZE_IF_NEEDED(), it also checks for allocated space:

int mpi_resize(MPI a, unsigned nlimbs)
{
....
if (nlimbs <= a->alloced)
return 0; /* no need to do it */



> David

\
 
 \ /
  Last update: 2016-11-24 12:32    [W:0.158 / U:0.596 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site