Re: [PATCH 1/1] crypto: asymmetric_keys: set error code on failure

From: David Howells
Date: Mon Dec 12 2016 - 11:10:28 EST


Pan Bian <bianpan201602@xxxxxxx> wrote:

> outlen = crypto_akcipher_maxsize(tfm);
> output = kmalloc(outlen, GFP_KERNEL);
> - if (!output)
> + if (!output) {
> + ret = -ENOMEM;
> goto error_free_req;
> + }

This is preferred:

+ ret = -ENOMEM;
outlen = crypto_akcipher_maxsize(tfm);
output = kmalloc(outlen, GFP_KERNEL);
if (!output)
goto error_free_req;

I'll alter your patch.

David