[Mesa-dev] [PATCH 02/10] gbm: don't deference createImageFromFds when it's NULL
Emil Velikov
emil.l.velikov at gmail.com
Mon Oct 16 15:54:20 UTC 2017
From: Emil Velikov <emil.velikov at collabora.com>
Entry-point was introduced with v7 and may be NULL.
Check and bail out accordingly.
Fixes: a43d286ef7f ("gbm: Add import from fd")
Cc: Kristian Høgsberg <krh at bitplanet.net>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 531361a04d9..35298751237 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -950,6 +950,12 @@ gbm_dri_bo_import(struct gbm_device *gbm,
int stride = fd_data->stride, offset = 0;
int fourcc;
+ if (dri->image->base.version < 7 ||
+ dri->image->createImageFromFds == NULL) {
+ errno = ENOSYS;
+ return NULL;
+ }
+
/* GBM's GBM_FORMAT_* tokens are a strict superset of the DRI FourCC
* tokens accepted by createImageFromFds, except for not supporting
* the sARGB format. */
--
2.14.1
More information about the mesa-dev
mailing list