From: Marcin Ślusarz Date: Thu, 30 Jul 2020 12:29:56 +0000 (+0200) Subject: iris: handle os_dupfd_cloexec failure X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0685815ea629d94532d3d8b7214c26d727e0280a;p=mesa.git iris: handle os_dupfd_cloexec failure Found by Coverity. Signed-off-by: Marcin Ślusarz Reviewed-by: Lionel Landwerlin Part-of: --- 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); }