Bug 421868

Summary: Bad check for mmap return value
Product: [Frameworks and Libraries] kwayland Reporter: hanno
Component: clientAssignee: Martin Flöser <mgraesslin>
Status: RESOLVED FIXED    
Severity: normal CC: kde, kwin-bugs-null
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: proposed patch

Description hanno 2020-05-21 16:36:57 UTC
Created attachment 128670 [details]
proposed patch

In the file shm_pool.cpp there are 2 places where the return value of mmap() is checked in a way that it expects a zero on failure. However this is wrong, mmap returns MAP_FAILED (or -1) on error.

Patch attached.
Comment 1 David Edmundson 2020-05-21 17:32:30 UTC
Well spotted
Comment 2 Bug Janitor Service 2021-07-12 09:41:46 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kwayland/-/merge_requests/36
Comment 3 David Edmundson 2021-07-12 11:29:55 UTC
Git commit 2adaa15a1c5911e95b4288e75b9a6229613152da by David Edmundson, on behalf of Hanno Böck.
Committed on 12/07/2021 at 11:29.
Pushed by davidedmundson into branch 'master'.

Fix check for mmap failure

Docs for mmap state it returns -1 if it can't map an address rather than
null.

M  +2    -2    src/client/shm_pool.cpp

https://invent.kde.org/frameworks/kwayland/commit/2adaa15a1c5911e95b4288e75b9a6229613152da