Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6052724rwp; Mon, 17 Jul 2023 14:06:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlFYwU4U8WQVller8LCmwt7j7zh8mRgt0Ku8h5qu0zsUBXSs8Ri3j6msL58Cn8A5F9cEgwyI X-Received: by 2002:a17:90a:e50f:b0:262:ee7d:2d18 with SMTP id t15-20020a17090ae50f00b00262ee7d2d18mr10357239pjy.18.1689627983150; Mon, 17 Jul 2023 14:06:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689627983; cv=none; d=google.com; s=arc-20160816; b=fSAOsvUyDBV54GijSym8wwuzWVuliN+xpNiTOroSMtd46/1M3ePt4btq1gFFSnJyuX H4jp9oUSLsRRtEr+EIJytqY/k4FHfGXbnyo5Ttv68gHj/1Xx1Vt8ZjOnw600YtWcdek2 uqVq6fww0kzpIi4+RnsAx2ccaU9rWZa3MF4uoOvkW0ULVM27LqrZWMt0517b6C/asSI3 wwxOl5ueMmZXGkGGsX8tFhVs1xs8Rvc1E5AyhqTSlNWNvrW3DBq5Xbgh36rWrQUl+6Jj ZbUvyFhbut9AbpNbpXVnmOpObLgw+MH+ep9gTP8MK2xhynyBIdqBsSI6xAhCAVEI4Jjc yhFg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=51K2lKG+q819lTMUGYmSNKY6/SqZqw9ZUhum5UPEwB4=; fh=CLPq7QbinQSVZA7N65n4uhPiamQHST74TBceNWSqx8g=; b=ggX0LBEf405AKHT5cPXqfnKFrYJXd77lR/PBmorNeipSN9qvcNQ6NQ0CQhGV0kABsJ ePa6dn1C0hCRTuIaauM+f2SyMOr1mI7jT6LuUqLdVcJONuV/agqvvzSc3u/qi9fvH3aE 45beiyHioscKI4B0x9wBcXJvdcpO2STHWDZPycBf8T3ZY/wZq+zL/mmkGGIlVRQtHYv2 MECwWnjzqoem/9NtESC+RiYyixMmjd0MZmrE8B8SacXrilmQb6rSJPV3Rm4eO/7euoWn 9+PQnS5Z+R6F6ETRPNFtn8v/mqhfczvLZyc3v3yPVhtqkOiz64XOHPrycjkVG73gH++v v3+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=m1vwc3Ri; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-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 pf4-20020a17090b1d8400b00263a923c189si488844pjb.100.2023.07.17.14.06.05; Mon, 17 Jul 2023 14:06:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=m1vwc3Ri; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-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 S230211AbjGQUxY (ORCPT + 99 others); Mon, 17 Jul 2023 16:53:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231281AbjGQUxR (ORCPT ); Mon, 17 Jul 2023 16:53:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65B3110CC for ; Mon, 17 Jul 2023 13:52:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E06CA61276 for ; Mon, 17 Jul 2023 20:52:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6F76C433CA; Mon, 17 Jul 2023 20:52:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689627161; bh=9DmJpO+l/sZ/a8mayGnHOMrUZXe2lzx/dv/ilWsBBxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m1vwc3Ri7VQglHwxh5wFl8Ndq7uvowrB6UxUoGX3jMIcCEJxlvCueVEFdov3Lx2Oe r1Sg7Hh6E1zxt7gTk9p2btDpO4FqaK3y5gChFvgVA4iuVvqRvSs31D8WUd4268FsZe xnWFhou7gj6Qh2WBuKK4PspoyVmyfXm4TUoLcWgW+/VoTPKVMCPA6/3oCsM22fMBPg fFbIPuFs9tPpG18r8rbVvM/5/3HucPzkqApUqxZNS5vBnNuqNf5BtBQyT/W+SaiSxv 4IcST8iaEEPVDEH2VYh/4ALtjErdrXrHh6QHqaLeL5Iw9QSPAGLFJy6mqG8JBr892E ukJ+ByLLrdjUA== From: Anna Schumaker To: linux-nfs@vger.kernel.org, trond.myklebust@hammerspace.com Cc: anna@kernel.org, krzysztof.kozlowski@linaro.org Subject: [PATCH v5 1/5] NFSv4.2: Fix READ_PLUS smatch warnings Date: Mon, 17 Jul 2023 16:52:35 -0400 Message-ID: <20230717205239.921002-2-anna@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230717205239.921002-1-anna@kernel.org> References: <20230717205239.921002-1-anna@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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-nfs@vger.kernel.org From: Anna Schumaker Smatch reports: fs/nfs/nfs42xdr.c:1131 decode_read_plus() warn: missing error code? 'status' Which Dan suggests to fix by doing a hardcoded "return 0" from the "if (segments == 0)" check. Additionally, smatch reports that the "status = -EIO" assignment is not used. This patch addresses both these issues. Reported-by: kernel test robot Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202305222209.6l5VM2lL-lkp@intel.com/ Fixes: d3b00a802c845 ("NFS: Replace the READ_PLUS decoding code") Signed-off-by: Anna Schumaker --- fs/nfs/nfs42xdr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c index 95234208dc9e..d0919c5bf61c 100644 --- a/fs/nfs/nfs42xdr.c +++ b/fs/nfs/nfs42xdr.c @@ -1056,13 +1056,12 @@ static int decode_read_plus(struct xdr_stream *xdr, struct nfs_pgio_res *res) res->eof = be32_to_cpup(p++); segments = be32_to_cpup(p++); if (segments == 0) - return status; + return 0; segs = kmalloc_array(segments, sizeof(*segs), GFP_KERNEL); if (!segs) return -ENOMEM; - status = -EIO; for (i = 0; i < segments; i++) { status = decode_read_plus_segment(xdr, &segs[i]); if (status < 0) -- 2.41.0