From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796204691; b=mDQbrUAHofNjYAw77UqLLwQoCW6p1eqnKBJTKxwV7GPymNb2FHa3gaYsKNkdkv32d9md QT23iHUNDjaVbl6SrxxdaDpqtCsfv3kVEDURrw/oOtjLfJzwIrcD7cALnEqI+tNB8kiDE /QAzLUo0gnAgBFII6zHgJKqrg2+83W5ofw3RveZMbOmuulvdbmBJg7DIjUBqVkQsDQiZw 5T3urMxIj+9c9VDElvHaTDiawg8/F3rRDobPsYX0i898Qsu7XkUNXUWfIcVIPyhFLNHsU d1LvVVZhlnIXGraLrjyTuzpifPIUMxpoysrjTcySPApFcT6lxyHXgK1Jo6//dYNvThw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796204691; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=uqaftALkP0iJVoXXaZmCYKtn77S2qL6YN9i8EXDfj/Q=; b=Xq43DLjKC+xZG9i58QehWBeHIJLUliQhY0U3KDkxRSy7u58cBF0/D7Qunqtwny2AsBPT 2jZd+FuylLAhhCSy0zl5Aru0cbd1Cggb3TVj2acUVZdoQVWSUkp4op1Zda1iZCAYSiotY h18iQwOO0cA4GzgME2DX+x/ijMrCT5JgtHr6lmHiXEn6Ucxi9w8J+Zt82SIvN02syiP3Z wTtCxWyFdv2WXVkAHUGGr55c2Cy3vdj1ON0nzGEDFXOUdffXh56lj+9Q23Eb+BVbIEdxe lDgupf4GEFpH2WVlnBcdunUZwBPYbdNbAQjWNNvGQaphqAdLlZMMNhJMTZ3nGIM+lZQ== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=ieQf5Nd1; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 08169606A329; Wed, 2 Dec 2026 09:44:50 +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: 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() Reply-To: sashiko-reviews@lists.linux.dev 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-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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