From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD604C001DC for ; Thu, 27 Jul 2023 14:40:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=4aj++9oMxfKsY/HKCmUgESVGT43Xo1yx23uE2cO9Kwc=; b=h3/nVAj/vTp21u832r1sa3iEfI 5t3QDXxSISutst8VFqEe6PjheCP3ZdNQz0CmRId5YrjokZ5rIUbwd2d9YO3DQIDk6zWvEmv1/pkH1 Q9AUZM+h9Lp2ucLn+t/4AV+RGTqdJijXTRnwyYyPdmcM7qoRj3oF2aKNt92gsBOUeT1hvSpLJKMsK M9XspdaKpidEXbW8tM/M/m3CuXRdFwYMSac3ShKuVQU1rBlbFhs0c7eV7tPY6MI6ivtl0X3VKFH07 02GNhPDndDntXtI696AIgvW2LDhkpQBfzefpfKEvpIHp1rcj/jfT6xvos9tLHNtpqRa0E0iY7Vxc9 64c5Rj3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qP2AS-00FJjo-0H; Thu, 27 Jul 2023 14:40:40 +0000 Received: from stargate.chelsio.com ([12.32.117.8]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qP2AO-00FJXc-39 for linux-nvme@lists.infradead.org; Thu, 27 Jul 2023 14:40:38 +0000 Received: from fcoe-test11.blr.asicdesigners.com (fcoe-test11.blr.asicdesigners.com [10.193.185.180]) by stargate.chelsio.com (8.14.7/8.14.7) with ESMTP id 36REe9UP006326; Thu, 27 Jul 2023 07:40:10 -0700 From: Varun Prakash To: sagi@grimberg.me, hch@lst.de Cc: linux-nvme@lists.infradead.org, varun@chelsio.com, Rakshana Sridhar Subject: [PATCH] nvmet-tcp: pass iov_len instead of sg->length to bvec_set_page() Date: Thu, 27 Jul 2023 20:35:50 +0530 Message-Id: <20230727150550.5851-1-varun@chelsio.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230727_074037_055131_D548FE05 X-CRM114-Status: UNSURE ( 8.75 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-nvme@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-nvme" Errors-To: linux-nvme-bounces+linux-nvme=archiver.kernel.org@lists.infradead.org iov_len is the valid data length, so pass iov_len instead of sg->length to bvec_set_page(). Fixes: 5bfaba275ae6 ("nvmet-tcp: don't map pages which can't come from HIGHMEM") Signed-off-by: Rakshana Sridhar Signed-off-by: Varun Prakash --- drivers/nvme/target/tcp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c index 868aa4de2e4c..05163751f2e5 100644 --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -348,8 +348,8 @@ static void nvmet_tcp_build_pdu_iovec(struct nvmet_tcp_cmd *cmd) while (length) { u32 iov_len = min_t(u32, length, sg->length - sg_offset); - bvec_set_page(iov, sg_page(sg), sg->length, - sg->offset + sg_offset); + bvec_set_page(iov, sg_page(sg), iov_len, + sg->offset + sg_offset); length -= iov_len; sg = sg_next(sg); -- 2.31.1