radeon: avoid possible divide by 0 in surface manager
PATCH 1/1 radeon: avoid possible divide by 0 in surface manager
Some users report hitting a divide by 0 with the tile split in certain apps. Tile_split shouldn't ever be 0 unless the surface structure was not properly initialized. I think there may be some cases where mesa uses an improperly initialized surface struct, but I haven't had time to track it down.
Bug:
https://bugs.freedesktop.org/show_bug.cgi?id=72425
--- radeon/radeon_surface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
radeon/radeon_surface.c +3 -3
@@ -655,7 +655,7 @@ static int eg_surface_init_2d(struct radeon_surface_manager *surf_man, tileb = tilew * tileh * bpe * surf->nsamples;/* slices per tile */ slice_pt =1 ; -if (tileb > tile_split) { +if (tileb > tile_split && tile_split) { slice_pt = tileb / tile_split; } tileb = tileb / slice_pt;
@@ -1621,7 +1621,7 @@ static int si_surface_init_2d(struct radeon_surface_manager *surf_man, tileb = tilew * tileh * bpe * surf->nsamples;/* slices per tile */ slice_pt =1 ; -if (tileb > tile_split) { +if (tileb > tile_split && tile_split) { slice_pt = tileb / tile_split; } tileb = tileb / slice_pt;
@@ -2223,7 +2223,7 @@ static int cik_surface_init_2d(struct radeon_surface_manager *surf_man,/* slices per tile */ slice_pt =1 ; -if (tileb > tile_split) { +if (tileb > tile_split && tile_split) { slice_pt = tileb / tile_split; tileb = tileb / slice_pt; }
Signature · 1 line
1.8.3.1
Marek
Quoted 48 lines · Alex Deucher
Some users report hitting a divide by 0 with the tile split in certain apps.
Tile_splitshouldn't ever be 0 unless the surface structure was not properly initialized. I think there may be some cases where mesa uses an improperly initialized surface struct, but I haven't had time to track it down.Bug:
https://bugs.freedesktop.org/show_bug.cgi?id=72425Signed-off-by Alex Deucher <[email protected]>--- radeon/radeon_surface.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)radeon/radeon_surface.c +3
-4@@ -655,7 +655,7 @@ static int eg_surface_init_2d(struct radeon_surface_manager *surf_man, tileb = tilew * tileh * bpe * surf->nsamples;/* slices per tile */ slice_pt =1 ; -if (tileb > tile_split) { +if (tileb > tile_split && tile_split) { slice_pt = tileb / tile_split; } tileb = tileb / slice_pt;@@ -1621,7 +1621,7 @@ static int si_surface_init_2d(struct radeon_surface_manager *surf_man, tileb = tilew * tileh * bpe * surf->nsamples;/* slices per tile */ slice_pt =1 ; -if (tileb > tile_split) { +if (tileb > tile_split && tile_split) { slice_pt = tileb / tile_split; } tileb = tileb / slice_pt;@@ -2223,7 +2223,7 @@ static int cik_surface_init_2d(struct radeon_surface_manager *surf_man,/* slices per tile */ slice_pt =1 ; -if (tileb > tile_split) { +if (tileb > tile_split && tile_split) { slice_pt = tileb / tile_split; tileb = tileb / slice_pt; } --1.8.3.1
Quoted 4 lines
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 5 lines · Alex Deucher
Some users report hitting a divide by 0 with the tile split in certain apps.
Tile_splitshouldn't ever be 0 unless the surface structure was not properly initialized. I think there may be some cases where mesa uses an improperly initialized surface struct, but I haven't had time to track it down.
It would be good to know where the bogus tile split is coming from though — who knows what else might be wrong in that case?
Signature · 7 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · Michel Dänzer
Quoted 5 lines · Alex Deucher
Some users report hitting a divide by 0 with the tile split in certain apps.
Tile_splitshouldn't ever be 0 unless the surface structure was not properly initialized. I think there may be some cases where mesa uses an improperly initialized surface struct, but I haven't had time to track it down.It would be good to know where the bogus tile split is coming from though — who knows what else might be wrong in that case?
Agreed. The reporter updated the bug with the full backtrace, I just haven't had a chance to look at it yet.
https://bugs.freedesktop.org/show_bug.cgi?id=72425
Alex
Quoted 6 lines
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer