Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1049372pxm; Thu, 3 Mar 2022 09:18:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxwrkTMZnUG9PLZ15biKnYHE8+u5tco23fhm1qtRyc96ah++VERVJ2Cm/59EQkE4zaqu5pB X-Received: by 2002:a17:90b:38c6:b0:1bf:1c98:7a09 with SMTP id nn6-20020a17090b38c600b001bf1c987a09mr1912972pjb.99.1646327933504; Thu, 03 Mar 2022 09:18:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646327933; cv=none; d=google.com; s=arc-20160816; b=mU3KhEsfWlR922CJ4K5UwvDXmeK7G4EEhNuS0LYpyZdOVae+ier8kakIdth/bi4QCV Ox2UvaNnf5uNpMW06iuBH88cY+ZiIRHUY/Kl37dpBNkV2iku8pU8vPgrU3F9z2zC6P2/ XwQ2bBEj3oahypyKLF5BwfiMsH6XfWf218+IIPDd/qrG2XNRo4W7fLR/WpeIhs5jlIir MRADxizvstiYpo+/n0k1ORRoSRL2BVlQLe42+JzXRTIyhPfI9Ti1HIQZ1+kGWAV9kmuY rFxurt/IG5ePRERLqqszTs2sqGtg2q6wmBWyspSEhjBCLo1/tvd0ErZNoKXFdo65L/8T tj4w== 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=Vt+Uj/Cwrd8XcJa1rlq7OHHjWzj6y8VSzywk4zBLZ+Q=; b=BAlerS7zgX5NNZtp0K4FmL6R9T0iFrTL0N+gcHjTHN22kv8JIuhkvzWjjJg9DlgzB6 mbXwj+Bv5/WakrHVYVveP/ra5sZj48A1wKsSoANnSf5xTG3z3xl8N+OD6kZm+JF/Xdin BqOJWneQdWqqDTfoKLS6FuZ3dz/gueVe6EAqfsiTqPp5LXfXNuXwiv299LxV45+CzT8y FY59gI4hobyHeZVCspKJzD23QHDGpxfGED8X1UFrio7l76S6tn9N6Pu4sSOWK3W2hFJo kpnCFs8IhHOsMXEt+CmpU1ScWhzb0zPbu9GMPSRDOxDja9YQGx+1bh7nDfcvuqyd3R9m a4CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vBlcTrMq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z36-20020a056a001da400b004f672a7b690si1812140pfw.379.2022.03.03.09.18.35; Thu, 03 Mar 2022 09:18:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vBlcTrMq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234471AbiCCQjw (ORCPT + 99 others); Thu, 3 Mar 2022 11:39:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230442AbiCCQjt (ORCPT ); Thu, 3 Mar 2022 11:39:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 580854C7A3 for ; Thu, 3 Mar 2022 08:39:04 -0800 (PST) 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 ams.source.kernel.org (Postfix) with ESMTPS id D3929B82665 for ; Thu, 3 Mar 2022 16:39:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35A1FC004E1; Thu, 3 Mar 2022 16:39:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1646325541; bh=lPZIdwsQWP4Ms3kPLc2NWlJMSgHkLZbSVVfg6uTj2t8=; h=From:To:Cc:Subject:Date:From; b=vBlcTrMqwITgcgixFeKGIJVNd+QfBd+W+CMDcY3J823vCyevZdebMg/bP50+g8I2t l01BDFCW/1Im8tvI4jqM1CvBcz6v9kNkD/5I9wg1UfEc9koWzJs5AHmCewWrOPMz6a E5m06ezrjDfUMPwemnFZPZDPQGbD3vzNY7zFgzSgcIFJOu7JnFjZfX2lnzUykEdjL9 MXBkzH7/d60evcn4ml0IqEMocABCOi4jSFPQShCWkRkx1QVbmQxZapQsCwI23WfrZC xRnf7Smp9Wqlp6+jTdHctWl7XSKqRubThHePVVSh4l7Zlm6AebmKjPHCtkv9UxbRnQ un+euIfN08gAg== From: Nathan Chancellor To: David Howells Cc: llvm@lists.linux.dev, linux-kernel@vger.kernel.org, Tom Rix , Nathan Chancellor , kernel test robot Subject: [PATCH] netfs: Ensure ret is always initialized in netfs_begin_read() Date: Thu, 3 Mar 2022 09:38:26 -0700 Message-Id: <20220303163826.1120936-1-nathan@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: fs/netfs/io.c:630:6: error: variable 'ret' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized] if (sync) { ^~~~ fs/netfs/io.c:655:9: note: uninitialized use occurs here return ret; ^~~ There is only one instance of netfs_begin_read() where sync is false and its return value is not checked so just return 0 in this case, as there is no return code from another function call to propagate. Fixes: 33e1e5d53058 ("netfs: Add a function to consolidate beginning a read") Link: https://github.com/ClangBuiltLinux/linux/issues/1607 Reported-by: kernel test robot Signed-off-by: Nathan Chancellor --- fs/netfs/io.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/netfs/io.c b/fs/netfs/io.c index 3db9356eb7c2..4a3b7989cd1c 100644 --- a/fs/netfs/io.c +++ b/fs/netfs/io.c @@ -651,6 +651,7 @@ int netfs_begin_read(struct netfs_io_request *rreq, bool sync) /* If we decrement nr_outstanding to 0, the ref belongs to us. */ if (atomic_dec_and_test(&rreq->nr_outstanding)) netfs_rreq_assess(rreq, false); + ret = 0; } return ret; } base-commit: 2522c1b16116325f69670076d0c82024fbcc4e8d -- 2.35.1