Mesa (master): radv: fix possible stack corruption

Grazvydas Ignotas notaz at kemper.freedesktop.org
Wed May 3 19:15:54 UTC 2017


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

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

radv: 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: 743315f2 "radv: do not open random render node(s)"
Signed-off-by: Grazvydas Ignotas <notasas at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

---

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

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 408c034785..9e66faf7ab 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -401,7 +401,7 @@ radv_enumerate_devices(struct radv_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