]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
accel/habanalabs: return ENOMEM if less than requested pages were pinned
authorTomer Tayar <tomer.tayar@intel.com>
Sun, 26 May 2024 13:32:32 +0000 (16:32 +0300)
committerKoby Elbaz <koby.elbaz@intel.com>
Thu, 25 Sep 2025 06:09:22 +0000 (09:09 +0300)
EFAULT is currently returned if less than requested user pages are
pinned. This value means a "bad address" which might be confusing to
the user, as the address of the given user memory is not necessarily
"bad".

Modify the return value to ENOMEM, as "out of memory" is more suitable
in this case.

Signed-off-by: Tomer Tayar <tomer.tayar@intel.com>
Reviewed-by: Koby Elbaz <koby.elbaz@intel.com>
Signed-off-by: Koby Elbaz <koby.elbaz@intel.com>
drivers/accel/habanalabs/common/memory.c

index 61472a381904ec2c8bab559e3fd16528f095edf9..48d2d598a387659647fe6c705759c57591fe4b3f 100644 (file)
@@ -2332,7 +2332,7 @@ static int get_user_memory(struct hl_device *hdev, u64 addr, u64 size,
                if (rc < 0)
                        goto destroy_pages;
                npages = rc;
-               rc = -EFAULT;
+               rc = -ENOMEM;
                goto put_pages;
        }
        userptr->npages = npages;