diff options
author | Axel Davy <davyaxel0@gmail.com> | 2021-03-28 18:30:40 +0200 |
---|---|---|
committer | Marge Bot <eric+marge@anholt.net> | 2021-04-14 08:33:13 +0000 |
commit | 68024fc0cc6d05c5a7b59e49bda64fc157757506 (patch) | |
tree | 91be08a5ea92183d5d44cfcd70dea728c3c455b0 | |
parent | 2146494d08d7355a7acde352c0f6eebae09f47c3 (diff) |
st/nine: Fix reading invalid pointer
Apparently it is incorrect to use the pointer in
LIST_FOR_EACH_ENTRY like I used to.
Found with asan.
Signed-off-by: Axel Davy <davyaxel0@gmail.com>
Acked-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10160>
-rw-r--r-- | src/gallium/frontends/nine/nine_memory_helper.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gallium/frontends/nine/nine_memory_helper.c b/src/gallium/frontends/nine/nine_memory_helper.c index ac9cde8a78a..6cf1fdaa899 100644 --- a/src/gallium/frontends/nine/nine_memory_helper.c +++ b/src/gallium/frontends/nine/nine_memory_helper.c @@ -367,12 +367,13 @@ static void move_region_ordered(struct list_head *tail, struct nine_memfd_file_r static void move_region_ordered_merge(struct nine_allocator *allocator, struct list_head *tail, struct nine_memfd_file_region *region) { - struct nine_memfd_file_region *cur_region = NULL, *prev_region = NULL; + struct nine_memfd_file_region *p, *cur_region = NULL, *prev_region = NULL; /* Remove from previous list (if any) */ list_delinit(®ion->list); - LIST_FOR_EACH_ENTRY(cur_region, tail, list) { + LIST_FOR_EACH_ENTRY(p, tail, list) { + cur_region = p; if (cur_region->offset > region->offset) break; prev_region = cur_region; |