From patchwork Mon Jul 31 20:49:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 109044 Delivered-To: patch@linaro.org Received: by 10.140.101.6 with SMTP id t6csp652194qge; Mon, 31 Jul 2017 13:50:00 -0700 (PDT) X-Received: by 10.99.104.74 with SMTP id d71mr16545347pgc.7.1501534200590; Mon, 31 Jul 2017 13:50:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501534200; cv=none; d=google.com; s=arc-20160816; b=rtC88D8bHveFjC7m0BQpLIS3gH+eUiPCY2LH43quyoNipPVVJygCj+59GDeOn4OwAl h7L4yrK2JsxCDNfHxtmyx7fYosIcPzG8DOfoZ0WBSiK+HFSmsHIcjT0JFz4QOMFwjj+P trSEU+V+2n50/N9oiXgyd8gyft0EV3ni1TWR1XwU6Avjbly6KTyQZoNILnyWSMcmbmvO yJV/XeRT5n0nbQdiOXEPAoSyTUD+++wyrMF2X/05+4YFsiiRiUdhO29Qb93hnVLsVDKi fQ85qT+/Z2q39FzEFol+Gjek0CsIgjnmjK1cfJ1p8ZdX4L9+a7dpQzIMvtljqTDZ5/W4 6c7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=RLTRVUtgQamaFHWCsATvS1s3AAv81c6K5poCQxzGdsg=; b=M5jMHirNvbg6shEUHkpbfk4L5P6gfqdpou5LItn7G7PVf2QhrLrLwdjzJtk4bz63vd uGL6eC21CyG7GhWw56o6mUe1s63Fq+frPIAiQUxo2QnN0GLuF0FqnmHf0uBOAfha4kKB s0jO6lq7pKy/p0siX8AwaRzWk6eikoUDDqNxy1VE55rrUB2xLw+LdOmb9sCzUxKtZIS2 7npCBZNES2vVnfqpGLPkFEO/WOG9pHS8TLvP/DHnex7kTuKPg8qaMLlxe7ko4pVezZX9 LUPHkVhGqDsldLr3hujc3yooO1efgF/MsGX/ZTykYuAlgbb/z5xWl/PKY0vljf61lL9t HIOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e193si16654319pgc.167.2017.07.31.13.50.00; Mon, 31 Jul 2017 13:50:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-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-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751052AbdGaUt7 (ORCPT + 1 other); Mon, 31 Jul 2017 16:49:59 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:52625 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751017AbdGaUt6 (ORCPT ); Mon, 31 Jul 2017 16:49:58 -0400 Received: from wuerfel.lan ([78.43.238.10]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.145]) with ESMTPA (Nemesis) id 0Mgpo8-1dGKu60AXg-00M1Pc; Mon, 31 Jul 2017 22:49:42 +0200 From: Arnd Bergmann To: Tom Lendacky , Gary Hook , Herbert Xu , "David S. Miller" Cc: Arnd Bergmann , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] crypto: ccp - avoid uninitialized variable warning Date: Mon, 31 Jul 2017 22:49:21 +0200 Message-Id: <20170731204936.1511542-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:16J3E1+kV4HMxtzQV1ny80lm2I5Vm4rS5MnLH/cKavrH6a6XhUG MzPxP0kK7pZl+guyooNoqI+9APUemEMcUbFHE1Avs3PzBHDf371dAly/nG9c7hs+ufbj6fh inVsAptkHciboe5kjz+SgVI/sJHcyYtkGLQRVVUJJSff0ZaTMI5fASW+k8iRmQy9Nj+/emI 8tcAtsJYGMIRyfvR+CM0w== X-UI-Out-Filterresults: notjunk:1; V01:K0:fueGUMRI/Gc=:yZbwCUR7Bz/xgcf01PS7Qr eZNUMjAJdlgwprty+isYIlkSYqrF4NVNT323aLsQ1eoIBtPLfYLWVQmqv8UmSJN0lLUhZFvrm u0W2/2PJlxdq9CDcz1HHIUORBw76NvPmmiJasgHxHD/Zg5tfEVTQ7U01eUzKnmsFmrm+iyqQm 0LfIboXkXg+p6aGy6UWaTtV9I3lxcO68A8YXQ0ok2a5UtHyh9G5yrp5cKOiz6f0IA7lDA3cm7 GENK+hcC3ADfgpJN9S/cQtRvE+cjibQTRxR4qtB4fELZfdv0cGH1F5rch+TA4clwmhgcSxvvd 2KAbCYBOh18SwUYHQ8ibf602BLFLSiKSXU7EpSAMnS3JvJ/MwL8/Jn5iAAg/i3uk3R/6AiziN PF5eopFFeomdgXvwhGqYtCPESmDv9B1KIPQwfHCzBDN+KSC40Wru6NGe8qjHdSRZdcXcScsnD nmQxXLumJquMlT7Dk3C5tPe1AdXD4edmxhxYAxVOfq9LL2F6v+k8NSB3UiSDp327jn5eYOKyW XP2Yy924S43I1cTYu4TCFG5eeS1VnA8C4I6D+n8XZOOh1bbuGbubaBWS6BurKXUVS2Vjq++SW gVbckDMlTsU7YRXGuFX+WDADf6CZKTe63MFj87FJlj30QYDVLK3zIVd3nHBKmTKCd3nGwuLYp 0Q6hbMjUwJCVzajj9uHtPxPVXwD3qTBD9lXmNZKt5z+tbOf1xG2SC+zAqSGzvOdhEDbuL5yjB Tbl2Ad7EmlwOSUPAAcVmGrLKPL/r7KEJY4Cqyg== Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org The added support for version 5 CCPs introduced a false-positive warning in the RSA implementation: drivers/crypto/ccp/ccp-ops.c: In function 'ccp_run_rsa_cmd': drivers/crypto/ccp/ccp-ops.c:1856:3: error: 'sb_count' may be used uninitialized in this function [-Werror=maybe-uninitialized] This changes the code in a way that should make it easier for the compiler to track the state of the sb_count variable, and avoid the warning. Fixes: 6ba46c7d4d7e ("crypto: ccp - Fix base RSA function for version 5 CCPs") Signed-off-by: Arnd Bergmann --- drivers/crypto/ccp/ccp-ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.9.0 Reviewed-by: Gary R Hook diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c index 40c062ad8726..a8bc207b099a 100644 --- a/drivers/crypto/ccp/ccp-ops.c +++ b/drivers/crypto/ccp/ccp-ops.c @@ -1758,6 +1758,7 @@ static int ccp_run_rsa_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) o_len = 32 * ((rsa->key_size + 255) / 256); i_len = o_len * 2; + sb_count = 0; if (cmd_q->ccp->vdata->version < CCP_VERSION(5, 0)) { /* sb_count is the number of storage block slots required * for the modulus. @@ -1852,7 +1853,7 @@ static int ccp_run_rsa_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) ccp_dm_free(&exp); e_sb: - if (cmd_q->ccp->vdata->version < CCP_VERSION(5, 0)) + if (sb_count) cmd_q->ccp->vdata->perform->sbfree(cmd_q, op.sb_key, sb_count); return ret;