summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrazvydas Ignotas <notasas@gmail.com>2017-05-02 19:41:13 +0300
committerGrazvydas Ignotas <notasas@gmail.com>2017-05-03 22:02:45 +0300
commit898cbb491b3c02697f006d175d5689893bdf929b (patch)
tree5bfc4d8edc9f37941aeca4eb1397c7abd72380a1
parentb08715499e61161b8dc070f125c5c2dc68e9afe7 (diff)
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@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
-rw-r--r--src/amd/vulkan/radv_device.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 408c0347856..9e66faf7ab8 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;