* [PATCH] misc: pci_endpoint_test: Use -EINVAL for small subrange size
@ 2026-03-20 14:01 Koichiro Den
2026-03-20 14:03 ` Niklas Cassel
2026-04-03 16:34 ` Manivannan Sadhasivam
0 siblings, 2 replies; 3+ messages in thread
From: Koichiro Den @ 2026-03-20 14:01 UTC (permalink / raw)
To: Manivannan Sadhasivam, Krzysztof Wilczyński,
Kishon Vijay Abraham I, Niklas Cassel, Christian Bruel,
Arnd Bergmann, Greg Kroah-Hartman
Cc: linux-pci, linux-kernel
The sub_size check ensures that each subrange is large enough for 32-bit
accesses. Subranges smaller than sizeof(u32) do not satisfy this
assumption, so this is a local sanity check rather than a resource
exhaustion case.
Return -EINVAL instead of -ENOSPC for this case.
Suggested-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Koichiro Den <den@valinux.co.jp>
---
drivers/misc/pci_endpoint_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/misc/pci_endpoint_test.c b/drivers/misc/pci_endpoint_test.c
index 55e128ed82f0..496c8f509590 100644
--- a/drivers/misc/pci_endpoint_test.c
+++ b/drivers/misc/pci_endpoint_test.c
@@ -543,15 +543,15 @@ static int pci_endpoint_test_bar_subrange(struct pci_endpoint_test *test,
if (bar_size % nsub || bar_size / nsub > SIZE_MAX) {
ret = -EINVAL;
goto out_clear;
}
sub_size = bar_size / nsub;
if (sub_size < sizeof(u32)) {
- ret = -ENOSPC;
+ ret = -EINVAL;
goto out_clear;
}
/* Limit the temporary buffer size */
buf_size = min_t(size_t, sub_size, SZ_1M);
read_buf = kmalloc(buf_size, GFP_KERNEL);
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] misc: pci_endpoint_test: Use -EINVAL for small subrange size
2026-03-20 14:01 [PATCH] misc: pci_endpoint_test: Use -EINVAL for small subrange size Koichiro Den
@ 2026-03-20 14:03 ` Niklas Cassel
2026-04-03 16:34 ` Manivannan Sadhasivam
1 sibling, 0 replies; 3+ messages in thread
From: Niklas Cassel @ 2026-03-20 14:03 UTC (permalink / raw)
To: Koichiro Den
Cc: Manivannan Sadhasivam, Krzysztof Wilczyński,
Kishon Vijay Abraham I, Christian Bruel, Arnd Bergmann,
Greg Kroah-Hartman, linux-pci, linux-kernel
On Fri, Mar 20, 2026 at 11:01:39PM +0900, Koichiro Den wrote:
> The sub_size check ensures that each subrange is large enough for 32-bit
> accesses. Subranges smaller than sizeof(u32) do not satisfy this
> assumption, so this is a local sanity check rather than a resource
> exhaustion case.
>
> Return -EINVAL instead of -ENOSPC for this case.
>
> Suggested-by: Niklas Cassel <cassel@kernel.org>
> Signed-off-by: Koichiro Den <den@valinux.co.jp>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] misc: pci_endpoint_test: Use -EINVAL for small subrange size
2026-03-20 14:01 [PATCH] misc: pci_endpoint_test: Use -EINVAL for small subrange size Koichiro Den
2026-03-20 14:03 ` Niklas Cassel
@ 2026-04-03 16:34 ` Manivannan Sadhasivam
1 sibling, 0 replies; 3+ messages in thread
From: Manivannan Sadhasivam @ 2026-04-03 16:34 UTC (permalink / raw)
To: Krzysztof Wilczyński, Kishon Vijay Abraham I, Niklas Cassel,
Christian Bruel, Arnd Bergmann, Greg Kroah-Hartman, Koichiro Den
Cc: linux-pci, linux-kernel
On Fri, 20 Mar 2026 23:01:39 +0900, Koichiro Den wrote:
> The sub_size check ensures that each subrange is large enough for 32-bit
> accesses. Subranges smaller than sizeof(u32) do not satisfy this
> assumption, so this is a local sanity check rather than a resource
> exhaustion case.
>
> Return -EINVAL instead of -ENOSPC for this case.
>
> [...]
Applied, thanks!
[1/1] misc: pci_endpoint_test: Use -EINVAL for small subrange size
commit: 9c55d0eb4e9d1bf229d691363fb0641a9b05d904
Best regards,
--
Manivannan Sadhasivam <mani@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-03 16:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20 14:01 [PATCH] misc: pci_endpoint_test: Use -EINVAL for small subrange size Koichiro Den
2026-03-20 14:03 ` Niklas Cassel
2026-04-03 16:34 ` Manivannan Sadhasivam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox