From 0685815ea629d94532d3d8b7214c26d727e0280a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marcin=20=C5=9Alusarz?= Date: Thu, 30 Jul 2020 14:29:56 +0200 Subject: [PATCH] iris: handle os_dupfd_cloexec failure MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Found by Coverity. Signed-off-by: Marcin Ślusarz Reviewed-by: Lionel Landwerlin Part-of: --- src/gallium/winsys/iris/drm/iris_drm_winsys.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gallium/winsys/iris/drm/iris_drm_winsys.c b/src/gallium/winsys/iris/drm/iris_drm_winsys.c index 57954e48273..a7a70283ef9 100644 --- a/src/gallium/winsys/iris/drm/iris_drm_winsys.c +++ b/src/gallium/winsys/iris/drm/iris_drm_winsys.c @@ -32,5 +32,8 @@ extern struct pipe_screen *iris_screen_create(int fd, const struct pipe_screen_c struct pipe_screen * iris_drm_screen_create(int fd, const struct pipe_screen_config *config) { - return iris_screen_create(os_dupfd_cloexec(fd), config); + int newfd = os_dupfd_cloexec(fd); + if (newfd < 0) + return NULL; + return iris_screen_create(newfd, config); } -- 2.30.2