From: Koichiro Den Date: Fri, 20 Mar 2026 14:01:39 +0000 (+0900) Subject: misc: pci_endpoint_test: Use -EINVAL for small subrange size X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c55d0eb4e9d1bf229d691363fb0641a9b05d904;p=thirdparty%2Fkernel%2Flinux.git misc: pci_endpoint_test: Use -EINVAL for small subrange size 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 Signed-off-by: Koichiro Den Signed-off-by: Manivannan Sadhasivam Reviewed-by: Niklas Cassel Link: https://patch.msgid.link/20260320140139.2415480-1-den@valinux.co.jp --- 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 @@ -547,7 +547,7 @@ static int pci_endpoint_test_bar_subrange(struct pci_endpoint_test *test, sub_size = bar_size / nsub; if (sub_size < sizeof(u32)) { - ret = -ENOSPC; + ret = -EINVAL; goto out_clear; }