Skip to content

iris: Properly bail on I915_QUERY errors instead of allocating trash

Kenneth Graunke requested to merge kwg/mesa:iris-query-meminfo-fix into main

We're trying to ask the kernel for DRM_I915_QUERY_MEMORY_REGIONS, but kernels prior to the introduction of that query type don't know about it and set item.length == -EINVAL. We failed to properly check that, and instead passed -EINVAL to calloc as a number of bytes to allocate.

This is a really bad idea and triggers valgrind warnings.

Fixes: e60114b2 ("iris/bufmgr: Query memory region info.")

Merge request reports