Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3251231yba; Mon, 8 Apr 2019 14:35:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqxiGAp5Yzb8FcgDVpPmAM7WsaqL1SHo0QUkquJT7FFcn9NIeU8qiIuHmIQ4mZVUbbygrA0h X-Received: by 2002:a17:902:32b:: with SMTP id 40mr10572989pld.204.1554759323476; Mon, 08 Apr 2019 14:35:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554759323; cv=none; d=google.com; s=arc-20160816; b=eBM8YkucwkFjGMfVWdtpwiHfLMF9f46yLLp0XXDWHlhwSrYuWHmPp+mgYV3EcvAaWp tRgSwoB4HwDiBGDgdcjyU5s0dmbCnvFNyirBvO4MwGHHtJ1ddvAAo+iOsI7J3jiFE3aT PVcWkNzNZpFMAljPstTbF6gb9wtlRFO40vEup1jamCjkNkwKFAbadffz4eV5SheUKBaJ +WpmlDR6N6ZhABg/oQ97I4aQZPeXBxAP4bL6xe07xmlHHXVqivGOmqCeloltB9Mw8aut jHY6GXa/xE+nxNtFtLsVjZxR5j6qkwfRqIUBqxSdeiztmimIzJM7+bsrpMPc8FOpY2wL JRyQ== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=WmjCH+hAkeeNgvUwfQYZhdoUQgTt+hoqMLJEY27+OjQ=; b=UGWhF2CZmFP1uPpoyKVi6+fqF+wd7sNNw9mSDMoUp+Jp35fJK8gfaUe2S/XIbhHd87 6OfKIdOknVMMz+S9YMvwGMvYVsDXogz1CfmuSet+K0xUTvMsen0kP+yUTUUz2uRN1nZT i7EhYfv8WTRPJcRNjXxO0cr4CSqP6w3GaXyntlx4SG1n3G/5ofxkTtrxH3Isppo3Q+rX Xh0L8mpHyd2G5R6kIUYjj9W1wlVHpr52z6WKX3DsMu5xafMD87yncQspJXbzFCYBNN4v Tl7QpojldfTi+GCwt1kytLRGwGhDP/sqhzbfKc0ScPPELVccRB3PVHNn73ZwxnbJJQpx iA9w== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8si26937049pff.277.2019.04.08.14.35.08; Mon, 08 Apr 2019 14:35:23 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729360AbfDHV2S (ORCPT + 99 others); Mon, 8 Apr 2019 17:28:18 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:48295 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729331AbfDHV2R (ORCPT ); Mon, 8 Apr 2019 17:28:17 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MxV4T-1gxqBH3pft-00xtsD; Mon, 08 Apr 2019 23:28:11 +0200 From: Arnd Bergmann To: Martin Schwidefsky , Heiko Carstens , Harald Freudenberger Cc: clang-built-linux@googlegroups.com, Nick Desaulniers , Nathan Chancellor , linux-s390@vger.kernel.org, Arnd Bergmann , Ingo Franzki , linux-kernel@vger.kernel.org Subject: [PATCH 05/12] s390: zcrypt: initialize variables before_use Date: Mon, 8 Apr 2019 23:26:18 +0200 Message-Id: <20190408212648.2407234-5-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190408212648.2407234-1-arnd@arndb.de> References: <20190408212648.2407234-1-arnd@arndb.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:f7LYLS+shNTGQVOERcPHnDGdSyHXSpqaZPjOyXA7Bymy6uFk7aK OfEMbohlPk5WJKMM/7rr/lnt6Go6uMTSPTZCyjmQK2Bq+5Xlxii9i9IvWKtXKZnA3KkEpxj XB0/O0gL+9+iJHwKIfutZmt6gpQO4eGg1gB64BrlSSQtRlmY/ENad/BLupkSCP2g9IhC+bd UjEjs2Lm7XJp7RFcufpKw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:hjuBKaVOxqE=:x7bWz60bcMTXae27O36o06 trXP0naJKX1dcVR4d8qwgf1OEtZ3k3Ltk0acPLc+nnq0sKpTNbX3/k2rOkU2Xzndh3hcGUqFC tD9pVIg3leSqcCADBhnk5QW0hdeHPb1RIrIzODsKmi59OTD4MpfWumzJuDYgiCKWobVE5H7zd eHdizh17HYrsRjW8bA0BB7US1KJzBYImTqLs1lQbz3J3vxvdnrvddpM0GG4q39/nFDOLVqSvv 8iOqggPCGrdcBRaYfSevvrOt2BE6lHo12ivDRjn16MXI4kHJ+X26SYmFdZcV/hZhPJtKmFsec VaAe0ySv5jZFcoyUWcz5Z87zQm1Q6WhkS3hq5uH7/9UUZayTNeoFtN+90CcaiLR9jRXOFF7Gc 3Nzku9B85LVccwrj/4NklgMEUa/+qGLee8gGgf/wh6WaTlMZzdYCLDCvvJSmcfmo6XPydop7L VxFdVsDCmBOlidoU/VulYzHM3kWWdWUOU2ll4PV5atFhYWEL6RwP4N+eFHuk1ZDCupwl81MP1 g0Ge8NtC50LiCuZOX5Aem22TMQdzmyjKiqowM0aX4R4k/dESVWdjTvUSBGPOHzlk/iqEHc3qm fHVkDddUKIY4HSKI7fmzhU6URA3N0QjgJdT2JWpk1AgToj48lsmO/BCFEF2yFKotsZ7CpYA+h TKThu3mZ/+xi3qGWJ+pRcDjlZeUqQ0ea2Y1//RwSmKzfmpJogYHGmsGvNL1Aj07QoouJ5yti0 FGNaSjBhhpx6I9IlsQEd5GlU/xrG9205lyEUKw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 'func_code' variable gets printed in debug statements without a prior initialization in multiple functions, as reported when building with clang: drivers/s390/crypto/zcrypt_api.c:659:6: warning: variable 'func_code' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (mex->outputdatalength < mex->inputdatalength) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/s390/crypto/zcrypt_api.c:725:29: note: uninitialized use occurs here trace_s390_zcrypt_rep(mex, func_code, rc, ^~~~~~~~~ drivers/s390/crypto/zcrypt_api.c:659:2: note: remove the 'if' if its condition is always false if (mex->outputdatalength < mex->inputdatalength) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/s390/crypto/zcrypt_api.c:654:24: note: initialize the variable 'func_code' to silence this warning unsigned int func_code; ^ Add initializations to all affected code paths to shut up the warning and make the warning output consistent. Signed-off-by: Arnd Bergmann --- drivers/s390/crypto/zcrypt_api.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index eb93c2d27d0a..23472063d9a8 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c @@ -657,6 +657,7 @@ static long zcrypt_rsa_modexpo(struct ap_perms *perms, trace_s390_zcrypt_req(mex, TP_ICARSAMODEXPO); if (mex->outputdatalength < mex->inputdatalength) { + func_code = -1; rc = -EINVAL; goto out; } @@ -739,6 +740,7 @@ static long zcrypt_rsa_crt(struct ap_perms *perms, trace_s390_zcrypt_req(crt, TP_ICARSACRT); if (crt->outputdatalength < crt->inputdatalength) { + func_code = -1; rc = -EINVAL; goto out; } @@ -946,6 +948,7 @@ static long zcrypt_send_ep11_cprb(struct ap_perms *perms, targets = kcalloc(target_num, sizeof(*targets), GFP_KERNEL); if (!targets) { + func_code = -1; rc = -ENOMEM; goto out; } @@ -953,6 +956,7 @@ static long zcrypt_send_ep11_cprb(struct ap_perms *perms, uptr = (struct ep11_target_dev __force __user *) xcrb->targets; if (copy_from_user(targets, uptr, target_num * sizeof(*targets))) { + func_code = -1; rc = -EFAULT; goto out_free; } -- 2.20.0