New: drmHandleEvent returns 0 on read() failure
https://bugs.freedesktop.org/show_bug.cgi?id=66332
Priority: medium
Bug ID: 66332
Assignee: [email protected]
Summary: drmHandleEvent returns 0 on read() failure
Severity: normal
Classification: Unclassified
OS: All
Reporter: [email protected]
Hardware: All
Status: NEW
Version: XOrg CVS
Component: libdrm
Product: DRI
drmHandleEvent contains this code:
len = read(fd, buffer, sizeof buffer);
if (len == 0)
return 0;
if (len < sizeof *e)
return -1;In the (len < sizeof *e) check, len gets promoted to size_t (which is unsigned); so when len is negative "return -1" won't be executed. Instead, the function continues to the end and returns 0. (The documentation states drmHandleEvent will return -1 if the read fails.)
If there's an error like EBADF, the caller won't detect it and might end up busy-waiting. Rewriting the condition as (len < (int)(sizeof *e)) will fix this.
Signature · 2 lines
You are receiving this mail because: You are the assignee for the bug.
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
[Bug 66332] drmHandleEvent returns 0 on read() failure
https://bugs.freedesktop.org/show_bug.cgi?id=66332
GitLab Migration User <[email protected]> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |MOVED
Status|NEW |RESOLVED--- Comment #1 from GitLab Migration User <[email protected]> --- -- GitLab Migration Automatic Message --
This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.
You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/mesa/drm/issues/11.
Signature · 2 lines
You are receiving this mail because: You are the assignee for the bug.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel