Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2541745rwd; Fri, 9 Jun 2023 12:53:33 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ76RirR6Q9dGmDvGr3+hknU+GsYBhEE/S7zbsFUGiR62Ujj59Nw6cUVzJDh4zUDEMJzwgds X-Received: by 2002:aa7:8890:0:b0:657:e9ae:e022 with SMTP id z16-20020aa78890000000b00657e9aee022mr2868440pfe.5.1686340413180; Fri, 09 Jun 2023 12:53:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686340413; cv=none; d=google.com; s=arc-20160816; b=lVCq1nfJuPXclG5jBFFEpcKuKmcT8aAnLle9jxj1LJYSjm6Shvqnr4uUsIBzaYfOfh Hdk4vzZ4YMtKxVGCleMzR25GUXbZgDAySFdXyqG3dfSXWoT0ZuKXNWC/wnaV2vpi87kW 9hR7PV8Dq4GHlKsWXtBJXndZg38EMPzA28OfO1lAzclScaXcyD9MeFPBIsZqt8zzswIb OZQ9wymAkXO7J4RhvvyaxOTnhyMUBDPB6sSpIDtoCtBv+3oPym6RYlF8f3RMCA7jllFp MkBMLzCjU83TeyaqUBcMCdzXjQcYi/1YGO48FICmHWGC5pMeXYwo4ik0CCsS+tEhqnwg ZTSQ== 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=XE2ZYsQn+z2wnfGrh6OzEaByMWqe+6ZwHW6nkZG8aoQ=; b=VHR9uqpZBUGZ9ChdooLMg+oEl+kEbyFi3qNULiOJJLfGqtdlg9qWj4O+jSxMnXh6ov mP4ltggO35N8g0HnR1wthQxoLebU2d3n9YLc25Uo73VcP8Wp5OGUNL0wbbkg/AWUWYZV AWw3wYDaKiikxTiBGoK5t7xV4v373kM5m9LBeEQNx/3ARVgowKNrmzgxyT502jPp/fli 4unkaDOG2SLEYm5A9f0aHdHnR6y/3OBm6sblF4Xq8DSc6pZeqyavufpS03o9dvOMbn/9 vTh8iqpb9F85YbPrRBiLQvhLlVH8uIkdOL0OFKLhX+ahbn18/FKMaHs/x6DojC6Y/WTu vx2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oOl9I8nr; 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 q141-20020a632a93000000b005341d2aa9dfsi3198533pgq.622.2023.06.09.12.53.20; Fri, 09 Jun 2023 12:53:33 -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=oOl9I8nr; 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 S230172AbjFITqR (ORCPT + 99 others); Fri, 9 Jun 2023 15:46:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229517AbjFITqR (ORCPT ); Fri, 9 Jun 2023 15:46:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B28A35A7 for ; Fri, 9 Jun 2023 12:46:15 -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 6B971602F3 for ; Fri, 9 Jun 2023 19:46:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80F77C433D2; Fri, 9 Jun 2023 19:46:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686339974; bh=/E1EHoJSWzYbAcL9AzZ/2dkUvD66hVq9kCDl0SCwkck=; h=From:To:Cc:Subject:Date:From; b=oOl9I8nr10rsjjqDcNpNsfC/FPwaNTkrJm/ODQrikK4infS0fD93WXdW5+vqFPA41 JqsJpzsFC8G5g5GHvS9aaqSqFVIqHq5TuPIz5ZooKnJ3jw/UU7MfeuVlVfRD9Th1Jm FeKBDBLMPdeRVMwb5XmyPfUHwTXqLDguRDp2CrgphwUO3voOfExV4mpJiZ7u6V3HBF acIXb8gIO+Xs8ljrhtCP/ORLnSdrL3pOcPgyVhi33rygKbwLMddjJZSGnnata+I4hR sZwTtMG9eaWYCcC+3wd0DovPvkpvZIaUSDTwzto8rcEDDZl6k0ZXX0Rm045AwtUZZJ cRtNYUn2xPBcQ== From: Anna Schumaker To: linux-nfs@vger.kernel.org, trond.myklebust@hammerspace.com Cc: anna@kernel.org Subject: [PATCH v2 1/3] NFSv4.2: Fix READ_PLUS smatch warnings Date: Fri, 9 Jun 2023 15:46:11 -0400 Message-ID: <20230609194613.848590-1-anna@kernel.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 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-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 a6df815a140c..ef3b150970ff 100644 --- a/fs/nfs/nfs42xdr.c +++ b/fs/nfs/nfs42xdr.c @@ -1136,13 +1136,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