crypto_kpp_maxsize() returns minimum length for output buffer or error code if key hasn't been set. Signed-off-by: Tudor Ambarus <tudor.ambarus@xxxxxxxxxxxxx> --- crypto/testmgr.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 87a4abd..0bf9a00 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -2013,6 +2013,11 @@ static int do_test_kpp(struct crypto_kpp *tfm, const struct kpp_testvec *vec, goto free_req; out_len_max = crypto_kpp_maxsize(tfm); + if (out_len_max < 0) { + err = out_len_max; + goto free_req; + } + output_buf = kzalloc(out_len_max, GFP_KERNEL); if (!output_buf) { err = -ENOMEM; -- 2.7.4