iris: handle os_dupfd_cloexec failure

Found by Coverity.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6126>
This commit is contained in:
Marcin Ślusarz 2020-07-30 14:29:56 +02:00 committed by Marge Bot
parent 612ef74190
commit 0685815ea6

View file

@ -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);
}