summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/intel/dev/gen_device_info.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/intel/dev/gen_device_info.c b/src/intel/dev/gen_device_info.c
index 3953a1f4af3..85fa978f9c1 100644
--- a/src/intel/dev/gen_device_info.c
+++ b/src/intel/dev/gen_device_info.c
@@ -1320,6 +1320,9 @@ query_topology(struct gen_device_info *devinfo, int fd)
if (gen_ioctl(fd, DRM_IOCTL_I915_QUERY, &query))
return false;
+ if (item.length < 0)
+ return false;
+
struct drm_i915_query_topology_info *topo_info =
(struct drm_i915_query_topology_info *) calloc(1, item.length);
item.data_ptr = (uintptr_t) topo_info;