Received: by 10.223.185.116 with SMTP id b49csp1228858wrg; Wed, 14 Feb 2018 13:42:06 -0800 (PST) X-Google-Smtp-Source: AH8x224E1zje/tBroqHpZB4F2N6hMtKrHZz/s9eGk/OmIhesmd7jBxp9+tiBROavtxwSLm0h3JcE X-Received: by 10.99.160.80 with SMTP id u16mr329089pgn.389.1518644526789; Wed, 14 Feb 2018 13:42:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518644526; cv=none; d=google.com; s=arc-20160816; b=ptvNXzUpRni4f+M37HIqgkzfmwftbKA2odBKzFj08OVETMWFSz1oGkCVpcMBqm8JjO WnGWgh4ftyUvLsPvHnkbz3jVRoJxOml1dAoAbiWWcJNiHGi9h2PuJuVAFWMXCT5BUpAA IQTetG688oxgqu3iY86OPfI2wZrX+z5TgdHCQT4FhcFjlJReas7Hst+hIKx8WV1IKgh9 AlFvxiYSHsKL1jaqH34PuzueGGWygcxlOTTJe/0KAPr23528kXtB12ycN5jVDhzMRJ3Z k9ZquaN3zkReSM38Tpiiwa/rDrsFUqiDr8Cd8xna7ySxJHTGiyfKP8leRjoYXmFQSyXD Rqxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:arc-authentication-results; bh=uxrAB0y8MwfOKHiivuOMWMGEp/c9wOy9W6HOOvZXkQs=; b=vuz5AJIX0nXcvQgFX7N1f31f5FPjrLkmaYwl2AUuxwrx8wzwjnX/N3JahJC58TxrAW 7S3wdHVflM7D4b1HqRaTp51JMgrBL2jzTubHecCvFSdOAn3boXLNOdr3XKBXdH8Tbtdk QyiwKAByI3h6rBid+40CN3GTTmMGYLmtWThF4xkQWmrmI7LsrjasaSIGvQFMM1mLZq5M WWhJa4YCrm0NlpvhDCmxcg4cPcWIAxxwu2JZDhKPjhsqCcMhbjsOV+8ed8YqWnRN4lOC yWecK7bQgnAzjtU4uFwIkWnNe+w7RWJ6bTmiL5YQIMm+iRYUwPczPWvKC8kPzuPYWZTg gUqA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e9si2825487pgt.828.2018.02.14.13.41.52; Wed, 14 Feb 2018 13:42:06 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=NONE dis=NONE) header.from=sourceforge.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031578AbeBNVkg (ORCPT + 99 others); Wed, 14 Feb 2018 16:40:36 -0500 Received: from mout.web.de ([212.227.15.4]:40361 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031455AbeBNVke (ORCPT ); Wed, 14 Feb 2018 16:40:34 -0500 Received: from [192.168.1.2] ([78.48.82.239]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MRA59-1fEQLc0NP5-00UXl9; Wed, 14 Feb 2018 22:40:27 +0100 Subject: [PATCH 2/2] crypto: bcm: One function call less in do_shash() after error detection From: SF Markus Elfring To: linux-crypto@vger.kernel.org, Arvind Yadav , Colin Ian King , "David S. Miller" , Herbert Xu , Rob Rice , Steve Lin Cc: LKML , kernel-janitors@vger.kernel.org References: <68946b12-83d6-ab74-fd54-71b23cf9b7ef@users.sourceforge.net> Message-ID: <55bdcf76-f1c9-180d-6798-959e617b10ac@users.sourceforge.net> Date: Wed, 14 Feb 2018 22:40:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <68946b12-83d6-ab74-fd54-71b23cf9b7ef@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:cvcOAkDMzLmPq1i0KvCjqGrMttGJPNENznKZFsQRYfulFQQqWch 4GoDOZunAH2PDjm4fJrAzYXbnCp+LSw14uo7AaY3b+x+u/CTD5aDQUYgvYPZyz2NQztllgS Ice/6NXv5J9oAThLEXTrngqgYt+6mCp8KRxEwZDrVIh4d2MKqC1tUjVbfmmT4+KyTizkwsJ xr5I0uk9jGz6u0+uOOJxw== X-UI-Out-Filterresults: notjunk:1;V01:K0:oxT/3ob+ulE=:5jfHN9RSqSIliB4alksj+L TVJyRCqBIsweYyQklXUY81YFB5ZGYroNngvUt+M2LzwKhj3Q67v/V5cEyKPCoD7h9531qIi8K JKb15rwjtKvUH52iQ8GV1kz/8qrrIe5sgE1ehQOwDeFhmfkCobwm6CgtVgt4tpAaMTYFVu9Ng JHjUbgRwoJyJK9bZ3L7SbHJEcUY3F20a9wZMrvEXvBMAs6U4Jrq47SjrbzEluNL+1E+2xUbVa Ks9zKTrmULcoUzI6yAv1Uj+4fBMgMtaoesWNveIuFcXVrIWWG5Bzper5fxhmFFn6+GtibsgRy cnS0DuM+2P4zgf4xR15gp8oxMsVswP2zLaGQ5eJBAbDQQyceTkOfYqA3E8bZo6I/329WY+c7x 4LdVAB4rNM6DZftrTd0BdzT+X5xg/9B+QMWAqduzdaOccsWAdveVgtnpDJYtum2G4bCOlfMiH yzi6acqJLhD6Q8+fzrx4ljkM4jkOpK3VmWyAQq4hC5H1TSXQOVzIPavnJQrtUvTYXWHP3BGtg BuE26I0EYWQSafVxPpWEC5AwhtPKQNt7Abs5LMuui9ORwiFUlvSq+Yv8xE/hl0ssYUgTMbSQ5 DZeTjjxuN1ullilQ38DAFpDCDeD+TS1rT+obAuXu6R32QTydG1+pXnILo8K0JOap72+rGK/XT KTEbkav8N9Ak7ixpWpWVp0Dey+ecjDAyj1LFNIW8eWE9K821c3Q52Ajb99AuWOdqGPIjsm88I k6jmFt+POLiEHlfExZKDDiOKWkynYDOePoX9YqSwY455TJuVrovJ27aEw35vtFTxn5gV9l9Dk hOlVWrLoMS+jUdBBZm/HgbL6ksJEugmBFH5ac4YIkeT2T3c1pE= Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Elfring Date: Wed, 14 Feb 2018 22:22:20 +0100 The kfree() function was called in one case by the do_shash() function during error handling even if the passed variable contained a null pointer. * Reorder two function calls at the end. * Add a jump target. Signed-off-by: Markus Elfring --- drivers/crypto/bcm/util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/bcm/util.c b/drivers/crypto/bcm/util.c index a912c6ad3e85..c141a0242223 100644 --- a/drivers/crypto/bcm/util.c +++ b/drivers/crypto/bcm/util.c @@ -279,7 +279,7 @@ int do_shash(unsigned char *name, unsigned char *result, sdesc = kmalloc(size, GFP_KERNEL); if (!sdesc) { rc = -ENOMEM; - goto do_shash_err; + goto free_shash; } sdesc->shash.tfm = hash; sdesc->shash.flags = 0x0; @@ -314,9 +314,9 @@ int do_shash(unsigned char *name, unsigned char *result, pr_err("%s: Could not generate %s hash\n", __func__, name); do_shash_err: - crypto_free_shash(hash); kfree(sdesc); - +free_shash: + crypto_free_shash(hash); return rc; } -- 2.16.1