[Intel-gfx] [PATCH 3/7] sna: check for NULL before dereferencing a pointer
Martin Peres
martin.peres at linux.intel.com
Fri Feb 12 16:31:25 UTC 2016
Caught by Klockwork and I genuinely can't tell if it is safe without
it, especially since all the surrounding code is checking for NULL.
Signed-off-by: Martin Peres <martin.peres at linux.intel.com>
---
src/sna/sna_accel.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 71a6207..8ceb1e1 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -3688,7 +3688,8 @@ sna_drawable_use_bo(DrawablePtr drawable, unsigned flags, const BoxRec *box,
__FUNCTION__, priv->flush, priv->shm, priv->cpu, flags));
if ((flags & PREFER_GPU) == 0 &&
- (flags & (REPLACES | IGNORE_DAMAGE) || !priv->gpu_damage || !kgem_bo_is_busy(priv->gpu_bo))) {
+ (flags & (REPLACES | IGNORE_DAMAGE) || !priv->gpu_damage ||
+ (priv->gpu_bo && !kgem_bo_is_busy(priv->gpu_bo)))) {
DBG(("%s: try cpu as GPU bo is idle\n", __FUNCTION__));
goto use_cpu_bo;
}
--
2.7.1
More information about the Intel-gfx
mailing list