From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6058B606A327 for ; Wed, 2 Dec 2026 09:45:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ieQf5Nd1 Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B344411201D; Wed, 2 Dec 2026 09:44:57 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 76DED11201D for ; Wed, 2 Dec 2026 09:44:51 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id D495F611C6; Wed, 2 Dec 2026 09:44:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F6D41F000C1; Wed, 2 Dec 2026 09:44:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796204690; bh=uqaftALkP0iJVoXXaZmCYKtn77S2qL6YN9i8EXDfj/Q=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=ieQf5Nd1IskYCm60nVJaIHBluLT66l7uxTqEWuhCoFbMOagU5Up7In4noSeAH3gKL WIOzqVRA+MUZrpiSSQobi1fLrPV7S9MBgU9WBy160VNXIXbO+CfKh9iuUHLREwkre4 YHMUsho7w1TeJf3rzkiVc1OZqu//ovswo6WjeoiMUkwbrvPnq/b731VHbDYBicIJ6x Izo8w3HlCkWeEBplSH8P4E8krNrzOic27k2j0vvIzbydd8N9j7CQpADBr6GCBMB3B6 4n9rD5uoWdE0jQnZRR9MQcnOdE61mNodiou/BbUjr9NatrCuyia7GxYlQqysuvnm7I rJYSKs3Bw3bpA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH 1/5] vfio/pci: Move the excluded windows out of vfio_pci_core_do_io_rw() To: mhonap@nvidia.com Cc: kvm@vger.kernel.org, virtualization@lists.linux.dev, dri-devel@lists.freedesktop.org, linux-cxl@vger.kernel.org, media-ci@linuxtv.org, "Michael S. Tsirkin" , "Eugenio Perez" In-Reply-To: <20261202093250.1683744-2-mhonap@nvidia.com> References: <20261202093250.1683744-1-mhonap@nvidia.com> <20261202093250.1683744-2-mhonap@nvidia.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Wed, 02 Dec 2026 09:44:49 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "dri-devel" X-Spam-Status: No, score=-10.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found no new issues in this patch, but noticed 1 related pre-existing issue it does not introduce: - [High] vfio/nvgrace-gpu: vfio_pci_core_do_io_rw() byte count treated as error [1] -- commit 483fcda0dfc229fdf013b0a4d4193d8e61dc59ac Author: Manish Honap vfio/pci: Move the excluded windows out of vfio_pci_core_do_io_rw() This commit moves the excluded range handling out of vfio_pci_core_do_io_rw() into a new vfio_pci_excluded_range_rw() helper in vfio_pci_bar_rw() and removes the window arguments from vfio_pci_core_do_io_rw() and its callers. > diff --git a/drivers/vfio/pci/nvgrace-gpu/main.c b/drivers/vfio/pci/nvgra= ce-gpu/main.c > index 5ddec340b73ba..432f6b9c2842b 100644 > --- a/drivers/vfio/pci/nvgrace-gpu/main.c > +++ b/drivers/vfio/pci/nvgrace-gpu/main.c > @@ -787,7 +787,7 @@ nvgrace_gpu_map_and_read(struct nvgrace_gpu_pci_core_= device *nvdev, > ret =3D vfio_pci_core_do_io_rw(&nvdev->core_device, false, > nvdev->resmem.ioaddr, > buf, offset, mem_count, > - 0, 0, false, VFIO_PCI_IO_WIDTH_8); > + false, VFIO_PCI_IO_WIDTH_8); > } > =20 > return ret; > @@ -925,7 +925,7 @@ nvgrace_gpu_map_and_write(struct nvgrace_gpu_pci_core= _device *nvdev, > ret =3D vfio_pci_core_do_io_rw(&nvdev->core_device, false, > nvdev->resmem.ioaddr, > (char __user *)buf, pos, mem_count, > - 0, 0, true, VFIO_PCI_IO_WIDTH_8); > + true, VFIO_PCI_IO_WIDTH_8); > } > =20 > return ret; [Severity: High] This problem wasn't introduced by this patch, but do nvgrace_gpu_map_and_read() and nvgrace_gpu_map_and_write() cause their callers to treat a successful vfio_pci_core_do_io_rw() transfer as an error [1]? vfio_pci_core_do_io_rw() returns the positive byte count transferred on success (or a negative errno on failure), whereas the USEMEM_REGION_INDEX branch returns 0 on success. Both nvgrace_gpu_read_mem() and nvgrace_gpu_write_mem() check "if (ret) return ret;", so any non-zero transfer on RESMEM_REGION_INDEX returns early without advancing *ppos, truncates the ssize_t byte count through int ret, and on reads straddling memregion->memlength skips filling the unmapped tail [mem_count, count) with 0xff and returns mem_count instead of count: drivers/vfio/pci/nvgrace-gpu/main.c:nvgrace_gpu_read_mem() { ... scoped_guard(rwsem_read, &vdev->memory_lock) { ... ret =3D nvgrace_gpu_map_and_read(nvdev, buf, mem_count, ppos); if (ret) return ret; } for (i =3D mem_count; i < count; i++) { ret =3D put_user(val, (unsigned char __user *)(buf + i)); if (ret) return ret; } *ppos +=3D count; return count; } [1] https://sashiko.dev/#/bug/linux-1d672947-b9c7-46b6-896d-b4214a0879d3 --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261202093250.1683= 744-1-mhonap@nvidia.com?part=3D1