From 44b57b5dfac1a61dcbfe7192f62460ab2e9ef5ca Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Fri, 12 May 2017 14:42:02 -0500 Subject: [PATCH] ecore_drm2: Add some safety checks for accessing dead fbs Accessing an fb after discarding it is bad karma, so we should log something if it ever happens. --- src/lib/ecore_drm2/ecore_drm2_fb.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/lib/ecore_drm2/ecore_drm2_fb.c b/src/lib/ecore_drm2/ecore_drm2_fb.c index b5161c6..8ef2d82 100644 --- a/src/lib/ecore_drm2/ecore_drm2_fb.c +++ b/src/lib/ecore_drm2/ecore_drm2_fb.c @@ -195,6 +195,7 @@ EAPI void * ecore_drm2_fb_data_get(Ecore_Drm2_Fb *fb) { EINA_SAFETY_ON_NULL_RETURN_VAL(fb, NULL); + EINA_SAFETY_ON_TRUE_RETURN_VAL(fb->dead, NULL); return fb->mmap; } @@ -202,6 +203,7 @@ EAPI unsigned int ecore_drm2_fb_size_get(Ecore_Drm2_Fb *fb) { EINA_SAFETY_ON_NULL_RETURN_VAL(fb, 0); + EINA_SAFETY_ON_TRUE_RETURN_VAL(fb->dead, 0); return fb->sizes[0]; } @@ -209,6 +211,8 @@ EAPI unsigned int ecore_drm2_fb_stride_get(Ecore_Drm2_Fb *fb) { EINA_SAFETY_ON_NULL_RETURN_VAL(fb, 0); + EINA_SAFETY_ON_TRUE_RETURN_VAL(fb->dead, 0); + return fb->strides[0]; } @@ -217,6 +221,7 @@ ecore_drm2_fb_dirty(Ecore_Drm2_Fb *fb, Eina_Rectangle *rects, unsigned int count { EINA_SAFETY_ON_NULL_RETURN(fb); EINA_SAFETY_ON_NULL_RETURN(rects); + EINA_SAFETY_ON_TRUE_RETURN(fb->dead); #ifdef DRM_MODE_FEATURE_DIRTYFB drmModeClip *clip; @@ -573,6 +578,7 @@ EAPI Eina_Bool ecore_drm2_fb_busy_get(Ecore_Drm2_Fb *fb) { EINA_SAFETY_ON_NULL_RETURN_VAL(fb, EINA_FALSE); + EINA_SAFETY_ON_TRUE_RETURN_VAL(fb->dead, EINA_FALSE); return !!(fb->ref - 1); } @@ -616,6 +622,8 @@ EAPI void * ecore_drm2_fb_bo_get(Ecore_Drm2_Fb *fb) { EINA_SAFETY_ON_NULL_RETURN_VAL(fb, NULL); + EINA_SAFETY_ON_TRUE_RETURN_VAL(fb->dead, NULL); + return fb->gbm_bo; } -- 2.7.4