From 4bf1924c008dffdc154f82507b4052e49263a6f4 Mon Sep 17 00:00:00 2001 From: David Howells Date: Wed, 18 Jan 2012 10:03:54 +0000 Subject: [PATCH] MPILIB: Add a missing ENOMEM check Add a missing ENOMEM check. Signed-off-by: David Howells Acked-by: Mimi Zohar Signed-off-by: James Morris --- lib/mpi/mpicoder.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/mpi/mpicoder.c b/lib/mpi/mpicoder.c index fe84bb978e3b..716802b774ea 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];