Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp159043pxu; Tue, 5 Jan 2021 07:34:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHxAjvnTTXrc0RogzkijuWtEU7B99xRzUVYjuaoIFUv9f0MS6jdIcjoBPxFQK2DyOoMXeQ X-Received: by 2002:aa7:c4c2:: with SMTP id p2mr291345edr.63.1609860865707; Tue, 05 Jan 2021 07:34:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609860865; cv=none; d=google.com; s=arc-20160816; b=n9rwYF3aDk5wfePn0e5o/1JMdsIJx1ITofI2mo7xhmtsr0j/Ua+sXaVrN9/LCAMY64 zM5d5Bp54Si4xpZdDx5BkEQM++NVcRrbLVbw9gXg9arY1Koxfq4lyDdHlrDq85FgQEaO C8TrcfuX/ixT5ze6pcSqS32n7/cnR8Ya+MtvOLHi1vfPHgKMS7bfQ5r9rDNl1dL6hO3e 6axA4PxmM2F2IGfeyENnc1O4KIojNSMGvwDG4Qvt9OKPl9jIUwaDlJb+04qMPOPv8UR/ LnfZUtoHRdOJ5n7mLuV+voJmm0HzJ3cTARNFddJrF2NhH32oHHd1HJcED4zUUdzHoG7K pEVA== 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:to:from:subject :sender:dkim-signature; bh=PfR+145Cl/h2AjN8p5PmJphXz5XskRvy/bZry0aSnnc=; b=o8nOpump4uryPRJ9A+1vi485NLxznNKwP3P9uzYRhPhC/vcp0iEHBDFx2152Klm7Xo 0KRXJA2Tbv7YK1z698MzdTq00verT0dU9PK/a+Id1hKka3fFP1ooynMERCftawdigkhS 6G0+dPkK6hH7A2cKHMbyq5Sgn7lC5Ke6f3KoBiCJD9ACYemdHKeNvc3wVeoaZba+Lmip pZZisVEX4aJRUc3oNoKQQJKDsE9CHwIa8iLzmnr8nkgOaGyC6h3pMfe8hPxmJ0r1qcn0 pdNGcCr1o0KNfgPcmu6txf2rOvFjm7mi6j1LCK/N4YWOI/WN6hVDp64z6XdqZ2CQZdLD 9fhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iC5Sg15k; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l1si31928859edv.442.2021.01.05.07.34.05; Tue, 05 Jan 2021 07:34:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=iC5Sg15k; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727747AbhAEPcQ (ORCPT + 99 others); Tue, 5 Jan 2021 10:32:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727520AbhAEPcQ (ORCPT ); Tue, 5 Jan 2021 10:32:16 -0500 Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC4FBC061574 for ; Tue, 5 Jan 2021 07:32:00 -0800 (PST) Received: by mail-qt1-x833.google.com with SMTP id z9so21066530qtn.4 for ; Tue, 05 Jan 2021 07:32:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=PfR+145Cl/h2AjN8p5PmJphXz5XskRvy/bZry0aSnnc=; b=iC5Sg15kKUejRn4Ji0+7Jxc3aWab+jgS/5LZ92I0kLSCM8BugI11RYPQfHFZw0cKwC 7ZfEOs3z9rABkJZT5LvWMQfO0CjDdoxbe8KWaLI5Iy2mQfwhk5uWNhn2hd8aYbr6Legf k3KIGtFgW8puPYRbrek3fvMHPUBSMvWyFWkR6ZDO0bi9XSte4P2GqxOK6fBWaM9x6WBp DRsKfWcH+epTRm/3M5eCC3jr04SXm4SLCos++IR0YDSNfF8TYgVQzsFcJAc5J5YfGGPs ISudTkdKrzAUGhPAhImrz+Lu/XoBx+0FwrdmaCtoKNe3X19hH147EfTLwWNORIiyaKMb lPxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:date:message-id :in-reply-to:references:user-agent:mime-version :content-transfer-encoding; bh=PfR+145Cl/h2AjN8p5PmJphXz5XskRvy/bZry0aSnnc=; b=HTostrRU/ZZ+l6p0h0tbqPH92i/8PMlFnOfOCkxAncmjnQzJwwqCofKj+uGyOVq8Tu x5iAL9h87MHbMTRz19lcmo0TRdvU7MYaYG8YveW+TbsV/O5PFpAeOYtYxJfU+W+8Rbzq ipNFZspaeBiphjqPpPZG6Wnn8nopwQrv2RNy3HMx7r5aGocgnRX2l0qaFBrncQUbd1iU I9lp4CvtfRi8ua4TCYDiGzwQkHhewaD4hwrtl9I94xrovbYrEsGnRTEu7drQstR7v1uq IBPRjK6/oDO2NiylEUH0d7Mf8RQT25tF02OGJdX0VN2yeCDPpUuotQ9JynH2lnCHwOZ/ OlZA== X-Gm-Message-State: AOAM532u47dD8uZUX3bH1+fmrR3bq2Eks8ldlyq7aXtT7OG/BPmqhab7 5bjyQPxd4CCLzoZIjS4USYPwLzqeHxY= X-Received: by 2002:ac8:7954:: with SMTP id r20mr83529qtt.78.1609860719868; Tue, 05 Jan 2021 07:31:59 -0800 (PST) Received: from gateway.1015granger.net (c-68-61-232-219.hsd1.mi.comcast.net. [68.61.232.219]) by smtp.gmail.com with ESMTPSA id i13sm135812qkk.83.2021.01.05.07.31.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Jan 2021 07:31:58 -0800 (PST) Sender: Chuck Lever Received: from klimt.1015granger.net (klimt.1015granger.net [192.168.1.55]) by gateway.1015granger.net (8.14.7/8.14.7) with ESMTP id 105FVvo6020898 for ; Tue, 5 Jan 2021 15:31:57 GMT Subject: [PATCH v1 26/42] NFSD: Update the NFSv2 READDIR argument decoder to use struct xdr_stream From: Chuck Lever To: linux-nfs@vger.kernel.org Date: Tue, 05 Jan 2021 10:31:57 -0500 Message-ID: <160986071797.5532.6943162493512709242.stgit@klimt.1015granger.net> In-Reply-To: <160986050640.5532.16498408936966394862.stgit@klimt.1015granger.net> References: <160986050640.5532.16498408936966394862.stgit@klimt.1015granger.net> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org As an additional clean up, move code not related to XDR decoding into readdir's .pc_func call out. Signed-off-by: Chuck Lever --- fs/nfsd/nfsxdr.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c index 3d72334e1673..7b33093f8d8b 100644 --- a/fs/nfsd/nfsxdr.c +++ b/fs/nfsd/nfsxdr.c @@ -381,15 +381,17 @@ nfssvc_decode_symlinkargs(struct svc_rqst *rqstp, __be32 *p) int nfssvc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p) { + struct xdr_stream *xdr = &rqstp->rq_arg_stream; struct nfsd_readdirargs *args = rqstp->rq_argp; - p = decode_fh(p, &args->fh); - if (!p) + if (!svcxdr_decode_fhandle(xdr, &args->fh)) + return 0; + if (xdr_stream_decode_u32(xdr, &args->cookie) < 0) + return 0; + if (xdr_stream_decode_u32(xdr, &args->count) < 0) return 0; - args->cookie = ntohl(*p++); - args->count = ntohl(*p++); - return xdr_argsize_check(rqstp, p); + return 1; } /*