Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753225AbcLLQKY (ORCPT ); Mon, 12 Dec 2016 11:10:24 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49106 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752905AbcLLQKW (ORCPT ); Mon, 12 Dec 2016 11:10:22 -0500 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <1480777024-7410-1-git-send-email-bianpan201602@163.com> References: <1480777024-7410-1-git-send-email-bianpan201602@163.com> To: Pan Bian Cc: dhowells@redhat.com, Herbert Xu , "David S. Miller" , keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, Pan Bian Subject: Re: [PATCH 1/1] crypto: asymmetric_keys: set error code on failure MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <12738.1481559018.1@warthog.procyon.org.uk> Date: Mon, 12 Dec 2016 16:10:18 +0000 Message-ID: <12739.1481559018@warthog.procyon.org.uk> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 12 Dec 2016 16:10:21 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 403 Lines: 21 Pan Bian 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