Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2072402rdb; Mon, 9 Oct 2023 11:30:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFWteIJUiNWq88L7DE/lapUn6EPLUWDGZLQOe08ZbkRTrFkpJ2cUYoPJ2hWAp6HxF+BQHW8 X-Received: by 2002:a17:90a:f990:b0:273:dffd:664a with SMTP id cq16-20020a17090af99000b00273dffd664amr12883914pjb.20.1696876252822; Mon, 09 Oct 2023 11:30:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696876252; cv=none; d=google.com; s=arc-20160816; b=OlS+1i0Rur7AJltJfVY0xPpATuchuYHrQe67FHvzScfYhehn3MOAph6pBAZyMM+xJr KNqVrersZLJr1yrCJPoTB5RKqzhHV0UusdkR+R+tMbJoCSqaINLn6PKIos5L1/USVpou cul1rjXxrn8C3T2qKmXGJGe/jf3ig5LZS6xBIBoaYE66zwQXFh9e0WHAVjQt8DNuSlq6 FOsoLA+iMIYPZ54nja6AHUVR0jFHrhjZVA/8FItUMXnZZIzD+I6Rz4TRCqg20OG7rMk1 x3PSM1M+qO6BzPIxsHqJIBtgrbjTAHlqSoh1Scx29L4ddNTGG8BYqNS9jCALWUWARy85 6tNw== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:dkim-signature; bh=8wp1CarSH3/RXqr2Rok93RJIRmyDjhy5VAekAI8VJuY=; fh=v8a13lpFSZWlL4AptTEJnmXnlqoWXhGCGCgvrcnCT9I=; b=SJ1nGwHZpgPnl6YX1j8jXU1AQAV59mKaoEXPSxsPrq6mZIWYbEBIR1wUSGovSAh69o aIv7KHpc2pg0Zw/79Wx6QR2j7xw8IPk066BK/qKKTRQw3E2hxe1Z4NAGfYAUgQ41Zv8k YVsDaukAnHjoD/N4+26HZZOveA9YdBmKG2EOHQUTjBYrEUOJ28omFgcN5FMJll240wJu nwqMghmlPMUsj+lvmJCCGePAvlKeSL+uwPzsNB1oQFdYK4GMh3rWQKk5xprzkiiI3HJ5 hV08nJUm1DoHo9OQEzRFzLgH02JuMZl5iO/WvSYFQ0OtfOlCkrDqlBLdSF443XJ4KWwg 8ouQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QcT8+q35; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id h6-20020a17090acf0600b002774df69ae4si10073360pju.92.2023.10.09.11.30.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 11:30:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=QcT8+q35; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 2DB78807600E; Mon, 9 Oct 2023 11:30:10 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377444AbjJISaH (ORCPT + 99 others); Mon, 9 Oct 2023 14:30:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377428AbjJISaG (ORCPT ); Mon, 9 Oct 2023 14:30:06 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02C92A3 for ; Mon, 9 Oct 2023 11:30:05 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 663D1C433C8; Mon, 9 Oct 2023 18:30:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696876204; bh=YOYaHInkqCa3F12GrFj7uIvV0c1cGEFasUsD5JMguhc=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=QcT8+q35vWJJI1qeUqWQwvBvqtRhmzqTxq1w9QXRAkuxvRKHvdefwmVOzjDMMds1X pgqFItJjDPFBPGNlq++MvaCknsKpKAW64JG8+pHQmCHRrm7BKoHAtqz/7KcPfeN5qk 055Q058vUk3edZMPVcNPFU3kT8dmbx6wxHVTW1/T+Lc7Q4iQuCsWjuqw0U1dIEREMU ep4ERm0So2pYpDuJi+dk4JR7VzzX+tVbXYILmQF0a4ptjaoQRD/QUUWYeKeUvfOtE6 2g0Ogjl0IBPKAPnixNAcZA8CGeXG3fVKqomv+hg3Pl/STkf3jhqErOZHz97qPTk3B0 oA0AX4NWVu36w== Subject: [PATCH v1 4/8] NFSD: Clean up nfsd4_encode_test_stateid() From: Chuck Lever To: linux-nfs@vger.kernel.org Cc: Chuck Lever Date: Mon, 09 Oct 2023 14:30:03 -0400 Message-ID: <169687620314.41382.724364262613906063.stgit@oracle-102.nfsv4bat.org> In-Reply-To: <169687606447.41382.568611605570999245.stgit@oracle-102.nfsv4bat.org> References: <169687606447.41382.568611605570999245.stgit@oracle-102.nfsv4bat.org> User-Agent: StGit/1.5 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 09 Oct 2023 11:30:10 -0700 (PDT) X-Spam-Level: ** From: Chuck Lever Use conventional XDR utilities. Signed-off-by: Chuck Lever --- fs/nfsd/nfs4xdr.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 85044cdcf2a7..859ee70e076f 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -4928,20 +4928,18 @@ nfsd4_encode_test_stateid(struct nfsd4_compoundres *resp, __be32 nfserr, union nfsd4_op_u *u) { struct nfsd4_test_stateid *test_stateid = &u->test_stateid; - struct xdr_stream *xdr = resp->xdr; struct nfsd4_test_stateid_id *stateid, *next; - __be32 *p; + struct xdr_stream *xdr = resp->xdr; - p = xdr_reserve_space(xdr, 4 + (4 * test_stateid->ts_num_ids)); - if (!p) + /* tsr_status_codes<> */ + if (xdr_stream_encode_u32(xdr, test_stateid->ts_num_ids) != XDR_UNIT) return nfserr_resource; - *p++ = htonl(test_stateid->ts_num_ids); - - list_for_each_entry_safe(stateid, next, &test_stateid->ts_stateid_list, ts_id_list) { - *p++ = stateid->ts_id_status; + list_for_each_entry_safe(stateid, next, + &test_stateid->ts_stateid_list, ts_id_list) { + if (xdr_stream_encode_be32(xdr, stateid->ts_id_status) != XDR_UNIT) + return nfserr_resource; } - - return 0; + return nfs_ok; } #ifdef CONFIG_NFSD_PNFS