summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/digsig.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/digsig.c b/lib/digsig.c
index a121cbc5a46b..55b8b2f41a9e 100644
--- a/lib/digsig.c
+++ b/lib/digsig.c
@@ -114,13 +114,15 @@ static int digsig_verify_rsa(struct key *key,
datap += remaining;
}
- err = -ENOMEM;
-
mblen = mpi_get_nbits(pkey[0]);
mlen = DIV_ROUND_UP(mblen, 8);
- if (mlen == 0)
+ if (mlen == 0) {
+ err = -EINVAL;
goto err;
+ }
+
+ err = -ENOMEM;
out1 = kzalloc(mlen, GFP_KERNEL);
if (!out1)