Commit d7a254fa authored by Srinivasan Shanmugam's avatar Srinivasan Shanmugam Committed by Alex Deucher

drm/amdkfd: Fix 'node' NULL check in 'svm_range_get_range_boundaries()'

Range interval [start, last] is ordered by rb_tree, rb_prev, rb_next
return value still needs NULL check, thus modified from "node" to "rb_node".

Fixes the below:
drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_svm.c:2691 svm_range_get_range_boundaries() warn: can 'node' even be NULL?
Suggested-by: default avatarPhilip Yang <Philip.Yang@amd.com>
Cc: Felix Kuehling <Felix.Kuehling@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: default avatarFelix Kuehling <felix.kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent c3d5e297
...@@ -2654,6 +2654,7 @@ svm_range_get_range_boundaries(struct kfd_process *p, int64_t addr, ...@@ -2654,6 +2654,7 @@ svm_range_get_range_boundaries(struct kfd_process *p, int64_t addr,
{ {
struct vm_area_struct *vma; struct vm_area_struct *vma;
struct interval_tree_node *node; struct interval_tree_node *node;
struct rb_node *rb_node;
unsigned long start_limit, end_limit; unsigned long start_limit, end_limit;
vma = vma_lookup(p->mm, addr << PAGE_SHIFT); vma = vma_lookup(p->mm, addr << PAGE_SHIFT);
...@@ -2673,16 +2674,15 @@ svm_range_get_range_boundaries(struct kfd_process *p, int64_t addr, ...@@ -2673,16 +2674,15 @@ svm_range_get_range_boundaries(struct kfd_process *p, int64_t addr,
if (node) { if (node) {
end_limit = min(end_limit, node->start); end_limit = min(end_limit, node->start);
/* Last range that ends before the fault address */ /* Last range that ends before the fault address */
node = container_of(rb_prev(&node->rb), rb_node = rb_prev(&node->rb);
struct interval_tree_node, rb);
} else { } else {
/* Last range must end before addr because /* Last range must end before addr because
* there was no range after addr * there was no range after addr
*/ */
node = container_of(rb_last(&p->svms.objects.rb_root), rb_node = rb_last(&p->svms.objects.rb_root);
struct interval_tree_node, rb);
} }
if (node) { if (rb_node) {
node = container_of(rb_node, struct interval_tree_node, rb);
if (node->last >= addr) { if (node->last >= addr) {
WARN(1, "Overlap with prev node and page fault addr\n"); WARN(1, "Overlap with prev node and page fault addr\n");
return -EFAULT; return -EFAULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment