From: Nicolai Stange Date: Thu, 26 May 2016 21:19:52 +0000 (+0200) Subject: lib/digsig: digsig_verify_rsa(): return -EINVAL if modulo length is zero X-Git-Tag: v4.14-rc1~2841^2~162 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c5ce7c697c983693c441573d2948e0ab8d62726e;p=platform%2Fkernel%2Flinux-rpi.git lib/digsig: digsig_verify_rsa(): return -EINVAL if modulo length is zero Currently, if digsig_verify_rsa() detects that the modulo's length is zero, i.e. mlen == 0, it returns -ENOMEM which doesn't really fit here. Make digsig_verify_rsa() return -EINVAL upon mlen == 0. Signed-off-by: Nicolai Stange Signed-off-by: Herbert Xu --- diff --git a/lib/digsig.c b/lib/digsig.c index a121cbc..55b8b2f 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)