Commit Graph

19769 Commits

Author SHA1 Message Date
Enrico Weigelt, metux IT consult db2568b834 fb: drop obsolete fbFillPolygon define
Hasn't been used since XAA removal, back 17 years ago. Probably just had been
forgotten to clean up.

See: 703a9645f3
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:39:38 +02:00
Enrico Weigelt, metux IT consult 7f835330a4 fb: drop FbRotStipLeft, FbRotRight, FbRotStipRight macros
Not used anywhere, so can be dropped. Doesn't seem to be ever used
since added over two decades ago.

See: 9508a382f8
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:39:35 +02:00
Enrico Weigelt, metux IT consult badafca022 fb: drop commented-out FbLeftBits and FbLeftBits macros
Not used anywhere, so can be dropped. They always have been commented-out
since added over two decades ago.

See: 9508a382f8

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:39:32 +02:00
Enrico Weigelt, metux IT consult c3fe57f095 fb: drop obsolete FB_STIP_ODDSTRIDE and FB_STIP_ODDPTR macro()
Those haven't been used for over a decade now, so no need to keep
it around any longer.

See: a198373685

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:39:29 +02:00
Enrico Weigelt, metux IT consult 093b029abf Xext: geext: drop obsolete geext.h
This header has now become obsolete. There're also no external consumers
(drivers, etc) left, so it now finally can be dropped entirely.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:39:26 +02:00
Enrico Weigelt, metux IT consult b49a585fae Xext: geext: unexport GERegisterExtension() and document it
Not used by any external module (eg drivers), so no need to keep it
exported. Also documenting it.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:39:23 +02:00
Enrico Weigelt, metux IT consult 1295fc3ff5 dri3: unexport VERIFY_DRI3_SYNCOBJ() macro
Not used by any drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:39:18 +02:00
Enrico Weigelt, metux IT consult 30c0dd3734 (!1956) dri3: move dri3_syncobj_type to non-public header
The symbol isn't exported, thus not accessible to modules.
No need to keep it in public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:36:19 +02:00
Enrico Weigelt, metux IT consult a5f8524d69 fb: overlay: drop unused fbOverlaySetupScreen()
Not used anywhere, neither internal nor drivers, so no need to keep
it around any longer.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:36:17 +02:00
Enrico Weigelt, metux IT consult 652d350c25 fb: overlay: make fbOverlayWindowExposures() static
Not used anywhere outside fboverlay.c, so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:36:12 +02:00
Enrico Weigelt, metux IT consult f5d0c64e8d fb: overlay: make fbOverlayCopyWindow() static
Not used anywhere outside fboverlay.c, so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:36:09 +02:00
Enrico Weigelt, metux IT consult 47269bf935 fb: overlay: make fbOverlayUpdateLayerRegion() static
Not used anywhere outside fboverlay.c, so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:36:04 +02:00
Enrico Weigelt, metux IT consult b399cf2fe1 fb: overlay: make fbOverlayPaintKey() static
Not used anywhere outside fboverlay.c, so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:36:02 +02:00
Enrico Weigelt, metux IT consult 097cbc3def fb: overlay: make fbOverlayCreateScreenResources() static
Not used anywhere outside fboverlay.c, so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:58 +02:00
Enrico Weigelt, metux IT consult 4a1850a3a9 fb: overlay: make fbOverlayWindowLayer() static
Not used anywhere outside fboverlay.c, so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:56 +02:00
Enrico Weigelt, metux IT consult ae4aa34456 fb: overlay: make fbOverlayCloseScreen() static
Not used anywhere outside fboverlay.c, so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:53 +02:00
Enrico Weigelt, metux IT consult 1d579528ef fb: overlay: make fbOverlayCreateWindow() static
Not used anywhere outside fboverlay.c, so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:50 +02:00
Enrico Weigelt, metux IT consult fd3d162331 os: xdmcp: handle allocation failure
| ../os/xdmcp.c: In function ‘get_mcast_options’:
| ../os/xdmcp.c:1527:27: warning: dereference of possibly-NULL ‘mcastinfo’ [CWE-690] [-Wanalyzer-possible-null-dereference]
|  1527 |             mcastinfo->ai = firstai;
|       |             ~~~~~~~~~~~~~~^~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:48 +02:00
Enrico Weigelt, metux IT consult c389f28af0 os: util: protect set_font_authorizations() from allocation failure
| ../os/utils.c: In function ‘set_font_authorizations’:
| ../os/utils.c:863:14: warning: dereference of possibly-NULL ‘result’ [CWE-690] [-Wanalyzer-possible-null-dereference]
|   863 |         *p++ = sizeof(AUTHORIZATION_NAME) >> 8;
|       |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:45 +02:00
Enrico Weigelt, metux IT consult eb09c17a54 os: ospoll_create(): protect from allocation failure
| ../os/ospoll.c: In function ‘ospoll_create’:
| ../os/ospoll.c:229:22: warning: dereference of possibly-NULL ‘ospoll’ [CWE-690] [-Wanalyzer-possible-null-dereference]
|   229 |     ospoll->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
|       |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:42 +02:00
Enrico Weigelt, metux IT consult 1e2842f3e5 composite: silence some warnings on possible NULL dereference
Unlikely to practically happen, but still safer to just check for sure.
A simple zero-value test doesn't cost us much (on modern CPUs perhaps
not even a full clock cycle).

| ../composite/compalloc.c: In function ‘compRedirectWindow’:
| ../composite/compalloc.c:167:35: warning: dereference of NULL ‘pClient’ [CWE-476] [-Wanalyzer-null-dereference]
|   167 |     ccw->id = FakeClientID(pClient->index);
|       |                            ~~~~~~~^~~~~~~

| ../composite/compalloc.c: In function ‘compUnredirectWindow’:
| ../composite/compalloc.c:331:75: warning: dereference of NULL ‘pClient’ [CWE-476] [-Wanalyzer-null-dereference]
|   331 |         if (ccw->update == update && dixClientIdForXID(ccw->id) == pClient->index) {
|       |                                                                    ~~~~~~~^~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:39 +02:00
Enrico Weigelt, metux IT consult 10e9f99fb2 exa: protect against NULL pointer dereference
Since GetPictureScreenIfSet() explicitly can return NULL, better be
prepared for that to happen (instead of hard crash)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:36 +02:00
Enrico Weigelt, metux IT consult 6308fb6bf6 kdrive: protect against allocation failures and NULL pointers
Even if those situations shouldn't practically happen, it's better to have
some sanity checks just in case.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:33 +02:00
Enrico Weigelt, metux IT consult 63097cb5c9 fb: pict: make fbGlyphs() static
Not used anywhere outside fbpict.c, so can become static.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:29 +02:00
Enrico Weigelt, metux IT consult b0e7326f6d fb: pict: unexport fbTriangles()
Not used by drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:19 +02:00
Enrico Weigelt, metux IT consult 12cb13d1fa fb: pict: unexport fbTrapezoids()
Not used by drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:17 +02:00
Enrico Weigelt, metux IT consult 587fd5c708 fb: pict: unexport fbAddTriangles()
Not used by drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:14 +02:00
Enrico Weigelt, metux IT consult 02e61f15a9 fb: pict: unexport fbRasterizeTrapezoid()
Not used by any drivers, so no need to keep it exported.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:11 +02:00
Enrico Weigelt, metux IT consult 5def7f3f64 render: NULL-protect SetPicturePictFilter()
Even though it shouldn't practically happen, better adding a trivial check,
just in case. The check is really cheap and possibly optimized-out.

| ../render/filter.c: In function ‘SetPicturePictFilter’:
| ../render/filter.c:388:36: warning: dereference of possibly-NULL ‘new_params’ [CWE-690] [-Wanalyzer-possible-null-dereference]
|   388 |         pPicture->filter_params[i] = params[i];
|       |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:08 +02:00
Enrico Weigelt, metux IT consult 67751f6096 render: NULL protect cpAlphaMap()
Even though it practically should never happen, but just in case, and
for silencing the analyzer, add an extra check here (which doesn't
cost us much).

| ../render/picture.c: In function ‘cpAlphaMap’:
| ../render/picture.c:1002:30: warning: dereference of NULL ‘screen’ [CWE-476] [-Wanalyzer-null-dereference]
|  1002 |         id = res->info[screen->myNum].id;
|       |                        ~~~~~~^~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:06 +02:00
Enrico Weigelt, metux IT consult 8a71c7338c render: glyph: extra NULL pointer protection
Even though it's probably never happening, but still better to protect from it,
just in case. The extra cost of it hard to measure on today's machines.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:03 +02:00
Enrico Weigelt, metux IT consult 00080db825 test: add assert()s to fix analyzer warnings
Reduce the analyzer spam a bit by adding some extra asserts.
Since it's test code, we can't have enough of them anyways ;-)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:35:00 +02:00
Enrico Weigelt, metux IT consult be4f551d9f test: fix FILE pointer leak
Fix leaking open FILE*.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:34:58 +02:00
Enrico Weigelt, metux IT consult f1e7e52aa3 record: protect from NULL pointers
Even though the situation probably never happens, but better being extra
cautious, just in case.

| ../record/set.c: In function ‘IntervalListCreateSet’:
| ../record/set.c:364:5: warning: use of NULL ‘stackIntervals’ where non-null expected [CWE-476] [-Wanalyzer-null-argument]
|   364 |     memcpy(&prls[1], stackIntervals, nIntervals * sizeof(RecordSetInterval));
|       |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:34:55 +02:00
Enrico Weigelt, metux IT consult 2be4669988 dix: a little bit more startup logging
Adding a little bit more logging to the startup process, eg. telling
when outputs or inputs have been initialized. Serving as a little aid for
debugging driver problems.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:34:50 +02:00
Enrico Weigelt, metux IT consult 8a5b65529c dix: protect input_option_set_value() from NULL pointer
Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:34:47 +02:00
Enrico Weigelt, metux IT consult 3178018b84 dix: extra NULL safety check in SetClipRects()
Even though it might never be actually hit, it's better to have an
(really cheap) extra check, just in case.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:34:44 +02:00
Enrico Weigelt, metux IT consult 9d13313511 dix: extra NULL protection in UnmapSubwindows()
Even though it probably won't be hit ever, it's still better to be
really sure instead of some remote chance for hard segfault.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:34:42 +02:00
Enrico Weigelt, metux IT consult ee7e43ab21 dix: clear free()ed pointers on CloseDownExtensions()
As safety precaution, clear the pointers to extion records that just
have been free()ed.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:34:39 +02:00
Enrico Weigelt, metux IT consult 77502c6836 dix: NULL-protect AllocGlyphCursor()
Return error to the client if sourcefont turns out to be NULL for
whatever reason.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:34:37 +02:00
Enrico Weigelt, metux IT consult af71108cd3 dix: devices: refine NULL checks in GetMaster()
The checking / branchin isn't entirely trivial to understand, and the
analyzer also gets confused. So rewrite it in an simpler way that's
easier to understand both the human reader as well as the analyzer.
(and so get rid of yet another false alarm)

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:34:34 +02:00
Enrico Weigelt, metux IT consult 4d3d4a34ec dix: region: turn xfreeData() into inline func and add checks
For type-safety turn xfreeData() macro into an inline function.
Also adding some checks against accidentially free()'ing global data.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:34:31 +02:00
Enrico Weigelt, metux IT consult 765cb85350 dix: make DeviceEnterLeaveEvent() anaylzer-friendly
The analyzer giving a false alarm on potential NULL-pointer deref here.
Even though that case can't happen, it's also not immediately clear
to the human reader.

To make both the analyzer as well human reader happier, reformulating
this function to by using fast-return pattern.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:34:29 +02:00
Enrico Weigelt, metux IT consult 7b7579e956 dix: protect ChangeWindowDeviceCursor() from allocation failure
On memory allocation failure, return BadAlloc instead of crashing.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:34:26 +02:00
Enrico Weigelt, metux IT consult 8b079ed198 include: regionstr.h: protect RegionUninit() from free()ing on .data
There might be a chance that RegionUninit() is trying to free() some
struct that's actually coming from .data segment.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:34:24 +02:00
Enrico Weigelt, metux IT consult 2b9ccde53a dix: dixfonts: explain analyzer false alarm on alleged free() of stack chunk
The analyzer is wrong here, because the free'd closure pointer really points
to some calloc()'d chunk, instead of the PolyText()'s stack frame.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:34:20 +02:00
Enrico Weigelt, metux IT consult 1e47ef4006 dix: NULL-protection in GestureAddRegularListener()
protect against the (unlikely) case that inputMasks == NULL.

| ../dix/gestures.c: In function ‘GestureAddRegularListener’:
| ../include/list.h:376:21: warning: dereference of NULL ‘0’ [CWE-476] [-Wanalyzer-null-dereference]
|   376 |         for (_entry = _list; _entry; _entry = (_entry)->_member)
| ../dix/gestures.c:241:9: note: in expansion of macro ‘nt_list_for_each_entry’
|   241 |         nt_list_for_each_entry(iclients, inputMasks->inputClients, next) {
|       |         ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:34:17 +02:00
Enrico Weigelt, metux IT consult f1ba454733 dix: protect from pScreen->SetCursorPosition == NULL
It's safer not relying on all ScreenProc's actually filled.

../dix/events.c: In function ‘CheckPhysLimits’:
../dix/events.c:780:14: warning: dereference of NULL ‘pScreen’ [CWE-476] [-Wanalyzer-null-dereference]
  780 |             (*pScreen->SetCursorPosition)
      |             ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:34:14 +02:00
Enrico Weigelt, metux IT consult 654c9c1f3d dix: touch: NULL-protection in TouchAddRegularListener()
protect against the (unlikely) case that inputMasks == NULL.

| ../dix/touch.c: In function ‘TouchAddRegularListener’:
| ../include/list.h:376:21: warning: dereference of NULL ‘0’ [CWE-476] [-Wanalyzer-null-dereference]
|   376 |         for (_entry = _list; _entry; _entry = (_entry)->_member)
| ../dix/touch.c:766:9: note: in expansion of macro ‘nt_list_for_each_entry’
|   766 |         nt_list_for_each_entry(iclients, inputMasks->inputClients, next) {
|       |         ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:34:12 +02:00
Enrico Weigelt, metux IT consult 076bc54064 dix: region: add comments on xfreeData()
Commenting a few aspects need to be considered when using this macro.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
2025-06-12 16:34:09 +02:00