Fix uninitialized use of local variable pitch in radeon_setup_kernel_mem
PATCH 1/1 Fix uninitialized use of local variable pitch in radeon_setup_kernel_mem
From: Michel Dänzer <[email protected]>
Fixes server reset.
Pointed out by clang:
../../src/radeon_kms.c:2721:9: warning: variable 'pitch' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (!info->front_buffer) {
^~~~~~~~~~~~~~~~~~~
../../src/radeon_kms.c:2765:27: note: uninitialized use occurs here
pScrn->displayWidth = pitch / cpp;
^~~~~
../../src/radeon_kms.c:2721:5: note: remove the 'if' if its condition is always true
if (!info->front_buffer) {
^~~~~~~~~~~~~~~~~~~~~~~~~
../../src/radeon_kms.c:2680:14: note: initialize the variable 'pitch' to silence this warning
int pitch;
^
= 0--- src/radeon_kms.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
src/radeon_kms.c +3 -2
@@ -2760,10 +2760,11 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)if (tiling_flags)radeon_bo_set_tiling (info->front_buffer->bo.radeon, tiling_flags, pitch); } - } - pScrn->displayWidth = pitch / cpp; + pScrn->displayWidth = pitch / cpp; + } + pitch = pScrn->displayWidth * cpp;xf86DrvMsg (pScrn->scrnIndex,X_INFO ,"Front buffer size: %dK\n" , pitch * pScrn->virtualY /1024 );radeon_kms_update_vram_limit (pScrn, pitch * pScrn->virtualY);
Signature · 6 lines
2.19.0.rc1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): 20180905162406.31154-1-michel-otUistvHUpPR7s880joybQ@public.gmane.org
Alex Deucher
Reviewed-byQuoted 21 lines · Michel Dänzer
From: Michel Dänzer <[email protected]>
Fixes server reset.
Pointed out by clang:
../../src/radeon_kms.c:2721:9: warning: variable 'pitch' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]if (!info->front_buffer) { ^~~~~~~~~~~~~~~~~~~ ../../src/radeon_kms.c:2765:27: note: uninitialized use occurs here pScrn->displayWidth = pitch / cpp; ^~~~~ ../../src/radeon_kms.c:2721:5: note: remove the 'if' if its condition is always true if (!info->front_buffer) { ^~~~~~~~~~~~~~~~~~~~~~~~~ ../../src/radeon_kms.c:2680:14: note: initialize the variable 'pitch' to silence this warning int pitch; ^ = 0
Quoted 1 line
Signed-off-by Michel Dänzer <[email protected]>
Quoted 25 lines
--- src/radeon_kms.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)src/radeon_kms.c +3
-3@@ -2760,10 +2760,11 @@ static Bool radeon_setup_kernel_mem(ScreenPtr pScreen)if (tiling_flags)radeon_bo_set_tiling (info->front_buffer->bo.radeon, tiling_flags, pitch); } - } - pScrn->displayWidth = pitch / cpp; + pScrn->displayWidth = pitch / cpp; + } + pitch = pScrn->displayWidth * cpp;xf86DrvMsg (pScrn->scrnIndex,X_INFO ,"Front buffer size: %dK\n" , pitch * pScrn->virtualY /1024 );radeon_kms_update_vram_limit (pScrn, pitch * pScrn->virtualY); --2.19.0.rc1
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx