Browse Source

lib/mpi: added missing NULL check

Added missing NULL check after mpi_alloc().

Signed-off-by: Dmitry Kasatkin <dmitry.kasatkin@intel.com>
Reviewed-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <jmorris@namei.org>
Dmitry Kasatkin 13 years ago
parent
commit
c70c471c58
1 changed files with 2 additions and 1 deletions
  1. 2 1
      lib/mpi/mpicoder.c

+ 2 - 1
lib/mpi/mpicoder.c

@@ -79,7 +79,8 @@ MPI do_encode_md(const void *sha_buffer, unsigned nbits)
 	}
 	}
 
 
 	a = mpi_alloc((nframe + BYTES_PER_MPI_LIMB - 1) / BYTES_PER_MPI_LIMB);
 	a = mpi_alloc((nframe + BYTES_PER_MPI_LIMB - 1) / BYTES_PER_MPI_LIMB);
-	mpi_set_buffer(a, frame, nframe, 0);
+	if (a)
+		mpi_set_buffer(a, frame, nframe, 0);
 	kfree(frame);
 	kfree(frame);
 
 
 	return a;
 	return a;