lib/mpi: Add the return value check of kcalloc()
[linux-2.6-block.git] / lib / mpi / mpi-mod.c
index 47bc59edd4ff939f961389bda33ede24917f53ec..54fcc01564d9dc6f1a1ae5b58ad820e503f64fbe 100644 (file)
@@ -40,6 +40,8 @@ mpi_barrett_t mpi_barrett_init(MPI m, int copy)
 
        mpi_normalize(m);
        ctx = kcalloc(1, sizeof(*ctx), GFP_KERNEL);
+       if (!ctx)
+               return NULL;
 
        if (copy) {
                ctx->m = mpi_copy(m);