mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-09 12:40:23 +01:00
iris: consider bufmgr creation to have failed if duping of the fd fails
Coverity points out that we can pass a negative value to `close()`, which results in an unchecked error. While this is technically true, it really isn't a problem as `close()` is speced to return -1 in that case (which we ignore). However, what is true is that if we fail to dup the fd (the only case where we could end up with a negative value), then we're in an unrecoverable error state anyway, and should go to the error cleanup code. CID: 1521539 Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Marcin Ślusarz <marcin.slusarz@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21568>
This commit is contained in:
parent
0912b14b3a
commit
814eb9e2ce
1 changed files with 3 additions and 0 deletions
|
|
@ -2396,6 +2396,8 @@ iris_bufmgr_create(struct intel_device_info *devinfo, int fd, bool bo_reuse)
|
|||
* fd so that its namespace does not clash with another.
|
||||
*/
|
||||
bufmgr->fd = os_dupfd_cloexec(fd);
|
||||
if (bufmgr->fd == -1)
|
||||
goto error_dup;
|
||||
|
||||
p_atomic_set(&bufmgr->refcount, 1);
|
||||
|
||||
|
|
@ -2512,6 +2514,7 @@ error_slabs_init:
|
|||
}
|
||||
error_engine_info:
|
||||
close(bufmgr->fd);
|
||||
error_dup:
|
||||
free(bufmgr);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue