Mesa (master): anv: fix possible stack corruption

Grazvydas Ignotas notaz at kemper.freedesktop.org
Tue May 9 22:15:31 UTC 2017


Module: Mesa
Branch: master
Commit: e0aee8b667955675e2e6c647a88048b64bc2796e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e0aee8b667955675e2e6c647a88048b64bc2796e

Author: Grazvydas Ignotas <notasas at gmail.com>
Date:   Tue May  2 19:26:17 2017 +0300

anv: fix possible stack corruption

drmGetDevices2 takes count and not size. Probably hasn't caused problems
yet in practice and was missed as setups with more than 8 DRM devices
are not very common.

Fixes: b1fb6e8d "anv: do not open random render node(s)"
Signed-off-by: Grazvydas Ignotas <notasas at gmail.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>

---

 src/intel/vulkan/anv_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c
index 5e4a62ba57..a64eae1ac9 100644
--- a/src/intel/vulkan/anv_device.c
+++ b/src/intel/vulkan/anv_device.c
@@ -510,7 +510,7 @@ anv_enumerate_devices(struct anv_instance *instance)
 
    instance->physicalDeviceCount = 0;
 
-   max_devices = drmGetDevices2(0, devices, sizeof(devices));
+   max_devices = drmGetDevices2(0, devices, ARRAY_SIZE(devices));
    if (max_devices < 1)
       return VK_ERROR_INCOMPATIBLE_DRIVER;
 




More information about the mesa-commit mailing list