Mesa (master): anv: Check file descriptor before closing.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Sep 28 22:50:05 UTC 2020
Module: Mesa
Branch: master
Commit: 93b8cdfe8bfb87335afc34458dcf1031b934f51a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=93b8cdfe8bfb87335afc34458dcf1031b934f51a
Author: Vinson Lee <vlee at freedesktop.org>
Date: Mon Sep 7 18:34:46 2020 -0700
anv: Check file descriptor before closing.
Fix defect reported by Coverity Scan.
Argument cannot be negative (NEGATIVE_RETURNS)
negative_returns: fd is passed to a parameter that cannot be negative
Signed-off-by: Vinson Lee <vlee at freedesktop.org>
Reviewed-by: Marcin Ślusarz <marcin.slusarz at intel.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6643>
---
src/intel/vulkan/anv_queue.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/intel/vulkan/anv_queue.c b/src/intel/vulkan/anv_queue.c
index fdf10f2c012..9a38ca85c9e 100644
--- a/src/intel/vulkan/anv_queue.c
+++ b/src/intel/vulkan/anv_queue.c
@@ -1915,7 +1915,8 @@ VkResult anv_ImportFenceFdKHR(
*
* If the import fails, we leave the file descriptor open.
*/
- close(fd);
+ if (fd != -1)
+ close(fd);
if (pImportFenceFdInfo->flags & VK_FENCE_IMPORT_TEMPORARY_BIT) {
anv_fence_impl_cleanup(device, &fence->temporary);
More information about the mesa-commit
mailing list