Re: [PATCH] MPILIB: Add a missing ENOMEM check

From: Kasatkin, Dmitry
Date: Wed Jan 18 2012 - 05:38:22 EST


On Wed, Jan 18, 2012 at 12:03 PM, David Howells <dhowells@xxxxxxxxxx> wrote:
> Add a missing ENOMEM check.
>
> Signed-off-by: David Howells <dhowells@xxxxxxxxxx>
> Acked-by: Mimi Zohar <zohar@xxxxxxxxxx>

Thanks.

> ---
>
> Âlib/mpi/mpicoder.c | Â Â2 ++
> Â1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/lib/mpi/mpicoder.c b/lib/mpi/mpicoder.c
> index fe84bb9..716802b 100644
> --- a/lib/mpi/mpicoder.c
> +++ b/lib/mpi/mpicoder.c
> @@ -255,6 +255,8 @@ void *mpi_get_buffer(MPI a, unsigned *nbytes, int *sign)
> Â Â Â Âif (!n)
> Â Â Â Â Â Â Â Ân++; Â Â Â Â Â Â/* avoid zero length allocation */
> Â Â Â Âp = buffer = kmalloc(n, GFP_KERNEL);
> + Â Â Â if (!p)
> + Â Â Â Â Â Â Â return NULL;
>
> Â Â Â Âfor (i = a->nlimbs - 1; i >= 0; i--) {
> Â Â Â Â Â Â Â Âalimb = a->d[i];
>
> --
> 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/