drm/xe/vm: fix xe_assert()
authorMatthew Auld <matthew.auld@intel.com>
Mon, 18 Mar 2024 10:36:17 +0000 (10:36 +0000)
committerMatthew Auld <matthew.auld@intel.com>
Tue, 19 Mar 2024 08:32:34 +0000 (08:32 +0000)
The region can be used an index into the region_to_mem_type, so we
should be asserting that it is less than the ARRAY_SIZE here.

Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Nirmoy Das <nirmoy.das@intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240318103616.26240-2-matthew.auld@intel.com
drivers/gpu/drm/xe/xe_vm.c

index cbb9b89..51d6232 100644 (file)
@@ -2033,7 +2033,7 @@ static int xe_vm_prefetch(struct xe_vm *vm, struct xe_vma *vma,
        struct xe_exec_queue *wait_exec_queue = to_wait_exec_queue(vm, q);
        int err;
 
-       xe_assert(vm->xe, region <= ARRAY_SIZE(region_to_mem_type));
+       xe_assert(vm->xe, region < ARRAY_SIZE(region_to_mem_type));
 
        if (!xe_vma_has_no_bo(vma)) {
                err = xe_bo_migrate(xe_vma_bo(vma), region_to_mem_type[region]);