summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2018-09-05 18:23:29 +0200
committerMichel Dänzer <michel@daenzer.net>2018-09-11 15:16:38 +0200
commit2d58830c3feafc54dccc0b7bf761a466437d4a09 (patch)
tree39616718ae4d8a205c2a03efae3435c208d7abe2
parent5d5d883496842da84d9418e91cb13454751da625 (diff)
Fix uninitialized use of local variable pitch in radeon_setup_kernel_mem
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; ^~~~~
-rw-r--r--src/radeon_kms.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index a2477681..ae69f335 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -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);