]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
misc: pci_endpoint_test: Use -EINVAL for small subrange size
authorKoichiro Den <den@valinux.co.jp>
Fri, 20 Mar 2026 14:01:39 +0000 (23:01 +0900)
committerManivannan Sadhasivam <mani@kernel.org>
Fri, 3 Apr 2026 16:34:36 +0000 (22:04 +0530)
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>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20260320140139.2415480-1-den@valinux.co.jp
drivers/misc/pci_endpoint_test.c

index 55e128ed82f00ae13b6fe9768cdbe56adbe8f9da..496c8f509590958c434b8cc2ca26f8c41a49b56a 100644 (file)
@@ -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;
        }