diff options
author | Dave Airlie <airlied@redhat.com> | 2009-12-13 23:51:35 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-12-16 00:33:32 -0500 |
commit | b663752627e7c6b4bc414684d71c6adce5719fce (patch) | |
tree | 604756a6116560a6986f589a92a32f3fa9ba9e34 /drivers/gpu/drm/ttm | |
parent | b8ff7357da45e025c446fe0479612215fe56a249 (diff) |
drm/ttm: fix two bugs in new placement routines.
a) the loops were going to <= not <, leading to illegal memory access
b) the busy placement checks were using the placement arrays not the
busy placement ones.
Acked-by: Jerome Glisse <jglisse@redhat.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/ttm')
-rw-r--r-- | drivers/gpu/drm/ttm/ttm_bo.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index 1fbb2eea5e88..4cd4007e68fa 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c | |||
@@ -849,7 +849,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, | |||
849 | int i, ret; | 849 | int i, ret; |
850 | 850 | ||
851 | mem->mm_node = NULL; | 851 | mem->mm_node = NULL; |
852 | for (i = 0; i <= placement->num_placement; ++i) { | 852 | for (i = 0; i < placement->num_placement; ++i) { |
853 | ret = ttm_mem_type_from_flags(placement->placement[i], | 853 | ret = ttm_mem_type_from_flags(placement->placement[i], |
854 | &mem_type); | 854 | &mem_type); |
855 | if (ret) | 855 | if (ret) |
@@ -900,8 +900,8 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, | |||
900 | if (!type_found) | 900 | if (!type_found) |
901 | return -EINVAL; | 901 | return -EINVAL; |
902 | 902 | ||
903 | for (i = 0; i <= placement->num_busy_placement; ++i) { | 903 | for (i = 0; i < placement->num_busy_placement; ++i) { |
904 | ret = ttm_mem_type_from_flags(placement->placement[i], | 904 | ret = ttm_mem_type_from_flags(placement->busy_placement[i], |
905 | &mem_type); | 905 | &mem_type); |
906 | if (ret) | 906 | if (ret) |
907 | return ret; | 907 | return ret; |
@@ -911,7 +911,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, | |||
911 | if (!ttm_bo_mt_compatible(man, | 911 | if (!ttm_bo_mt_compatible(man, |
912 | bo->type == ttm_bo_type_user, | 912 | bo->type == ttm_bo_type_user, |
913 | mem_type, | 913 | mem_type, |
914 | placement->placement[i], | 914 | placement->busy_placement[i], |
915 | &cur_flags)) | 915 | &cur_flags)) |
916 | continue; | 916 | continue; |
917 | 917 | ||
@@ -921,7 +921,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, | |||
921 | * Use the access and other non-mapping-related flag bits from | 921 | * Use the access and other non-mapping-related flag bits from |
922 | * the memory placement flags to the current flags | 922 | * the memory placement flags to the current flags |
923 | */ | 923 | */ |
924 | ttm_flag_masked(&cur_flags, placement->placement[i], | 924 | ttm_flag_masked(&cur_flags, placement->busy_placement[i], |
925 | ~TTM_PL_MASK_MEMTYPE); | 925 | ~TTM_PL_MASK_MEMTYPE); |
926 | 926 | ||
927 | ret = ttm_bo_mem_force_space(bo, mem_type, placement, mem, | 927 | ret = ttm_bo_mem_force_space(bo, mem_type, placement, mem, |