Re: [PATCH 1/1] lib/mpi: Fixed erroneous check on return value of mpi_resize()

From: Kasatkin, Dmitry
Date: Mon May 07 2012 - 09:20:35 EST


On Sat, May 5, 2012 at 4:51 AM, Adarsh J <root@xxxxxxxxxxxxx> wrote:
> mpi_resize() returns -ENOMEM on error and 0 on success.
>
> Signed-off-by: Adarsh J <root@xxxxxxxxxxxxx>

Acked-by: Dmitry Kasatkin <dmitry.kasatkin@xxxxxxxxx>

Thanks.

> ---
> Âlib/mpi/mpicoder.c | Â Â2 +-
> Â1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/mpi/mpicoder.c b/lib/mpi/mpicoder.c
> index f26b41f..9949b69 100644
> --- a/lib/mpi/mpicoder.c
> +++ b/lib/mpi/mpicoder.c
> @@ -98,7 +98,7 @@ int mpi_fromstr(MPI val, const char *str)
> Â Â Â Ânbytes = (nbits + 7) / 8;
> Â Â Â Ânlimbs = (nbytes + BYTES_PER_MPI_LIMB - 1) / BYTES_PER_MPI_LIMB;
> Â Â Â Âif (val->alloced < nlimbs)
> - Â Â Â Â Â Â Â if (!mpi_resize(val, nlimbs))
> + Â Â Â Â Â Â Â if (mpi_resize(val, nlimbs) < 0)
> Â Â Â Â Â Â Â Â Â Â Â Âreturn -ENOMEM;
> Â Â Â Âi = BYTES_PER_MPI_LIMB - nbytes % BYTES_PER_MPI_LIMB;
> Â Â Â Âi %= BYTES_PER_MPI_LIMB;
> --
> 1.7.9.5
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/