Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp777788pxu; Thu, 3 Dec 2020 12:20:59 -0800 (PST) X-Google-Smtp-Source: ABdhPJxJy8lUpsBKXgDhj5pGJyhZe9aueQ4ya6vaA+5owDDh06fKR8uWeB+glSbCPhGiV0ust2tT X-Received: by 2002:a17:906:3187:: with SMTP id 7mr4127430ejy.225.1607026858823; Thu, 03 Dec 2020 12:20:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607026858; cv=none; d=google.com; s=arc-20160816; b=fzZnm8irUfSU777EFdy6xiVkGVa8jRu/1uMnDYjyk8+O/QUoFLW4DY7L4mYTnuyI7m jMxcfLd0tGKtWSvnW/rtX1ldPbAQWRA7V0X9nKVkU4GkhUtlMYJBwEB12lS90VzZ0MTD c8H/O0VDw0OrnM0C7hafOtX4Hkla+/hQCqzINAF/aSaSyak8WM7/nd3Jvw4z4otHLHqr 7endkW34iW+WVpuVcYJV1ZdsOsVeKJfOq5qtOnqzPPk8hw49c2/ZfMuJciVWVo1sudJd PY3CTj4NlLEbGXB8+okfgcRYnTr18dzAXDo13nI9YIj0xVVsR2HByI6EcJnlHs6VtQqM r9hg== 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:sender :dkim-signature; bh=T1cjsePf2wHK5cj8ShKsUDNynGhFjKDY0ROw5ITEQmA=; b=PAwJ6Xjx4woiAHRj3wppInTnjFETOl7hL5POm9nCWLN6edRXaCQX+saZvzIRQ4OgSl 8rNt54gnBB+jYMW1AibJj5oU0OMmqju84dTYPxy8EMDsPR+gldt+2GkmZ7D7RX1d/ern JqS5rDuJtwNwAKIww459w9lpy3yzLYF0PY1SiNZAq6cmeFGX4PI/Y56Mu7XkhLe3poLY aKa8l5mbX+Gfo4ghNoqmgHvsAS+7pI3TLDLKbG0LG6YJeNl4fqhSddabnVyzdRFPnB8r 9Ze8iFaMR4h80FEc7dpzzAGu/ORZUMx+J6a0ULvPHSYRnT4KMtXtHKsV/Aw6jHcoqC+D iXHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=oYJbu4Cg; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dd25si1548056edb.438.2020.12.03.12.20.35; Thu, 03 Dec 2020 12:20:58 -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=oYJbu4Cg; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727929AbgLCUT2 (ORCPT + 99 others); Thu, 3 Dec 2020 15:19:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727844AbgLCUT1 (ORCPT ); Thu, 3 Dec 2020 15:19:27 -0500 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C3BBC061A54 for ; Thu, 3 Dec 2020 12:18:47 -0800 (PST) Received: by mail-qk1-x743.google.com with SMTP id i199so3404328qke.5 for ; Thu, 03 Dec 2020 12:18:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=T1cjsePf2wHK5cj8ShKsUDNynGhFjKDY0ROw5ITEQmA=; b=oYJbu4CgJ6ipd3YL7eXCNZDu4KsiXVOd1sQOIOoZiE4LY9Ic/bRAIEGfhPUvnJYar4 Ut6SZbXH1cT1oOz3srvf5A+kUkKi45OfbT2fYQbLfNCPaxzKSayDEsUuGPVNH/F8e0WF yx0siKkcIofYX6G3CkDWhAzkqhBjZuxuh5/XgqyAS/WyvD7AswbVLvj+v2qcorAbH2Mk daQRbjKNo3VjDgFZFMwSeKJew2KV7uhZ4vJt+g0x0KNYrCMNhCHYpuTf0xBqQ8I8fEf/ YUvZD3FIUbDjAFb6phQ+eAN4yoWNaIRuZJcnm5A7wNneNrHlSNWTojY8NTecMEl78Dwh cC0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=T1cjsePf2wHK5cj8ShKsUDNynGhFjKDY0ROw5ITEQmA=; b=TbuiXzMJrcRWcZcUFMf5MbJSZXw649IPPTEKElu+fNc+o84w2jG0DH/qYC49gTZ1Xy Z0FgftanL2i2WrCwsPk5V2zcV7IpGVFRUnrPH6KqzBdUSBI8P87CEesK2zKOYz/s686+ R8ubl3DNlAT2BtJi2K5+7T47w/giGAiG999NUUAbBl/vl5ZzDRIJQLIzYSyufLZpH/QG 4b1Qmw3Q6Vq03C1QAupjII+0rlkrp7/wfhBr02jyGjV13cC7vzxxIJ4A5igXjtCHN8LU onS01z+r30mM4x6HHvdyYZJGx+DIPdV3wXxgSBw40C4mITrSpXYK1iDcc5Tyx2t0fbzU xNCA== X-Gm-Message-State: AOAM5322MPS1lC2KTtj4AIob9RttDeuL27VSY04KSrUt2am7AhJ7srFg u9bunThaxyAldP+ETpZwf99NPZW/qyA= X-Received: by 2002:a37:a484:: with SMTP id n126mr4693353qke.277.1607026726395; Thu, 03 Dec 2020 12:18:46 -0800 (PST) Received: from gouda.nowheycreamery.com (c-68-32-74-190.hsd1.mi.comcast.net. [68.32.74.190]) by smtp.gmail.com with ESMTPSA id q20sm2194530qtn.80.2020.12.03.12.18.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 12:18:45 -0800 (PST) Sender: Anna Schumaker From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH 3/3] SUNRPC: Keep buf->len in sync with xdr->nwords when expanding holes Date: Thu, 3 Dec 2020 15:18:41 -0500 Message-Id: <20201203201841.103294-4-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201203201841.103294-1-Anna.Schumaker@Netapp.com> References: <20201203201841.103294-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker Otherwise we could end up placing data a few bytes off from where we actually want to put it. Signed-off-by: Anna Schumaker --- net/sunrpc/xdr.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c index 71e03b930b70..5b848fe65c81 100644 --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c @@ -1314,6 +1314,7 @@ uint64_t xdr_expand_hole(struct xdr_stream *xdr, uint64_t offset, uint64_t lengt unsigned int res = _shift_data_right_tail(buf, from + bytes - shift, shift); truncated = shift - res; xdr->nwords -= XDR_QUADLEN(truncated); + buf->len -= 4 * XDR_QUADLEN(truncated); bytes -= shift; } @@ -1325,7 +1326,7 @@ uint64_t xdr_expand_hole(struct xdr_stream *xdr, uint64_t offset, uint64_t lengt bytes); _zero_pages(buf->pages, buf->page_base + offset, length); - buf->len += length - (from - offset) - truncated; + buf->len += length - (from - offset); xdr_set_page(xdr, offset + length, PAGE_SIZE); return length; } -- 2.29.2