Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4690457iob; Sun, 8 May 2022 22:07:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/fbShlzuVl+3bcYMl5UeVFGLDEVZJEIN5NcEMuOGKUizYDgGhGx4xMJ7u7BU8d+z4Wj8g X-Received: by 2002:a63:3d5:0:b0:3c5:74b3:6988 with SMTP id 204-20020a6303d5000000b003c574b36988mr12171639pgd.234.1652072878567; Sun, 08 May 2022 22:07:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652072878; cv=none; d=google.com; s=arc-20160816; b=EPyc4qZi+aoI06onKl4Ssqj8dFwQeRPmw2MnPPIO1Iu40KIxBVgnNboH6FkXIXgw8z ldlr2DrrTRXfZibdU+ZIhVOMASI5lwfAPYd9tK3f5AD+CxstBjB4vXG+CeS6lVfAr2Eb BleLPGTOTdROPiKRYGtkyO0znD9Zt6bZi2jN0RUaCOO2Aav93seQktT99h2QyNyUmUXf w0Y80sPNGepHKrJ6jkGW3In+Q15botiPAXRVRA7STdNCUMSFEfrkFw0mGzy/TX/3nBdN xRygBj3nykX/HfsJa018CqujIr6U/IHQYqoLn/AIznb7nKCIuTsDnSmqpYTqjhPM4+kC h/QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=v/FQi+PH0ky+i5bGonCwbhF5Gx2og22wYvXmkg5LDJ4=; b=0opd919qr2wkejToZpFeVwR8zziFmCcyYJ2LX943MyQ7+TdG2oKBHKc8mU/PMcRj+j W/Z64C+Ijc0s62xsuSJd/E+PvpluYq8ZuZBjYM7wGz794VhVjkFFh7Xcl+wnQ2K5mmCX eaSw3YQQCbJK0nD59nDeJHcAWuIpejZVYvjJ+NhqgCtiG3pcu1qcfylPuYcyVKSWQq2i osEObaTG5DWj6ee2oOpv3FTgvRkqusF7X3kTbLWqtRpxER9CZ2dnDbTwZv9v72x7g0YV MEQ+6oNq5gbkAbLoF2+PVod76gN3aZQLy8ZJ2GBUfL9dRKcljv6+IiJpikYxpgXpicHf BvZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rOcnY6Ej; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id v38-20020a634666000000b003c247b0b459si12103914pgk.447.2022.05.08.22.07.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 22:07:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rOcnY6Ej; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3B781AE7E; Sun, 8 May 2022 22:00:51 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1392301AbiEFPJL (ORCPT + 99 others); Fri, 6 May 2022 11:09:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442648AbiEFPJB (ORCPT ); Fri, 6 May 2022 11:09:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42844AA for ; Fri, 6 May 2022 08:05:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D0E5A6219D for ; Fri, 6 May 2022 15:05:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75A3CC385AA; Fri, 6 May 2022 15:05:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651849516; bh=fhDnj/gHUadlVDzinZrEMzeeuKCFomPvapKUxScb6vI=; h=From:To:Cc:Subject:Date:From; b=rOcnY6Ej2CD34II/WUkNS091v7OFyebuwqx6UDIxJd+8YzGSBX9rw9nBcF4Fq7Lra QMAJhPxU2LRHFzT5OL8KZ8m/9k+yPY6hmHaSflp34or4toYQ5If/ajNfPqCBzSG6zM GbevKLhbnrWIu96TPEnJzH3djkwNnWsnUtbZO8B9mJ+Igl6/gESqVLBMnsrr9NzVMm BXo79yoW+yZ+NQNhkLuidU1Ib3+SOhjrhpaT7HiAecqcHDULUA7a8R6aRmyL6Mr7g+ 3FUSaBmjw2QS4d6VDoatUWykXn+b7D70gGVI21hzfeRVVlgm8M3T5xttdmmXP9gk2L mQYfji4aaIMQw== From: Nathan Chancellor To: Jens Axboe , Christoph Hellwig , Keith Busch , Sagi Grimberg Cc: Nick Desaulniers , Tom Rix , Kanchan Joshi , Anuj Gupta , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, Nathan Chancellor , kernel test robot Subject: [PATCH] nvme: Ensure ret is always initialized in Date: Fri, 6 May 2022 08:03:58 -0700 Message-Id: <20220506150357.2443040-1-nathan@kernel.org> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Clang warns: drivers/nvme/host/ioctl.c:674:6: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] if (ns) ^~ drivers/nvme/host/ioctl.c:677:9: note: uninitialized use occurs here return ret; ^~~ drivers/nvme/host/ioctl.c:674:2: note: remove the 'if' if its condition is always true if (ns) ^~~~~~~ drivers/nvme/host/ioctl.c:672:9: note: initialize the variable 'ret' to silence this warning int ret; ^ = 0 1 error generated. Initialize ret to zero so that it cannot be used uninitialized. Fixes: 271ee3df5cca ("nvme: wire-up uring-cmd support for io-passthru on char-device.") Link: https://github.com/ClangBuiltLinux/linux/issues/1630 Reported-by: kernel test robot Signed-off-by: Nathan Chancellor --- Or alternatively, remove the 'if (ns)' if ns can never be NULL; I tried going down the rabbit hole to see if that is possible but I got a little lost :^) drivers/nvme/host/ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/ioctl.c b/drivers/nvme/host/ioctl.c index 9db88f2c15f8..3ad5285c1f96 100644 --- a/drivers/nvme/host/ioctl.c +++ b/drivers/nvme/host/ioctl.c @@ -669,7 +669,7 @@ int nvme_ns_head_chr_uring_cmd(struct io_uring_cmd *ioucmd, struct nvme_ns_head *head = container_of(cdev, struct nvme_ns_head, cdev); int srcu_idx = srcu_read_lock(&head->srcu); struct nvme_ns *ns = nvme_find_path(head); - int ret; + int ret = 0; if (ns) ret = nvme_ns_uring_cmd(ns, ioucmd, issue_flags); base-commit: 002b149a51a53facaf26d7c6f2c1fe718673683c -- 2.36.0