xserver: Branch 'server-21.1-branch' - 12 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Oct 11 00:24:38 UTC 2024
dix/colormap.c | 1 +
dix/devices.c | 2 +-
dix/dixfonts.c | 27 ++++++++++++++-------------
dix/enterleave.c | 13 ++++++++++---
dix/eventconvert.c | 12 ++++++++++++
dix/gc.c | 3 ++-
dix/property.c | 45 ++++++++++++++++++++++++++-------------------
dix/ptrveloc.c | 1 +
dix/resource.c | 2 +-
9 files changed, 68 insertions(+), 38 deletions(-)
New commits:
commit 00d0eba826bbf4b35becbd3fab1ee10e8b3bb89d
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 13:27:45 2024 -0700
dix: FindBestPixel: fix implicit fallthrough warning
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 9c9e1afeb277030380daa9b22f88b05e1af783a0)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1717>
diff --git a/dix/colormap.c b/dix/colormap.c
index 7a00d14d6..b5b34d656 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -1250,6 +1250,7 @@ FindBestPixel(EntryPtr pentFirst, int size, xrgb * prgb, int channel)
case PSEUDOMAP:
dg = (long) pent->co.local.green - prgb->green;
db = (long) pent->co.local.blue - prgb->blue;
+ /* fallthrough */
case REDMAP:
dr = (long) pent->co.local.red - prgb->red;
break;
commit 52813e32f26c16b8210dbf5e4e2be7b8a4406360
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 13:21:14 2024 -0700
dix: GetPairedDevice: check if GetMaster returned NULL
Clears warning from gcc 14.1:
../dix/devices.c: In function ‘GetPairedDevice’:
../dix/devices.c:2734:15: warning: dereference of NULL ‘dev’
[CWE-476] [-Wanalyzer-null-dereference]
2734 | return dev->spriteInfo? dev->spriteInfo->paired: NULL;
| ~~~^~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit e6fc0861d8016ab31536329acac6d6de4bc64164)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1717>
diff --git a/dix/devices.c b/dix/devices.c
index c4b2587b1..a01773236 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2714,7 +2714,7 @@ GetPairedDevice(DeviceIntPtr dev)
if (!IsMaster(dev) && !IsFloating(dev))
dev = GetMaster(dev, MASTER_ATTACHED);
- return dev->spriteInfo? dev->spriteInfo->paired: NULL;
+ return (dev && dev->spriteInfo) ? dev->spriteInfo->paired: NULL;
}
/**
commit 65644c32b8062dd73b10e5f9092dfb833f469719
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 11:59:07 2024 -0700
dix: HashResourceID: use unsigned integers for bit shifting
Clears warning from gcc 14.1:
../dix/resource.c: In function ‘HashResourceID’:
../dix/resource.c:691:44: warning: left shift of negative value
[-Wshift-negative-value]
691 | return (id ^ (id >> numBits)) & ~((~0) << numBits);
| ^~
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 26a7ab09eae24fda6cbf51e03f974c7572e80e69)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1717>
diff --git a/dix/resource.c b/dix/resource.c
index 055e6934e..28f2f2139 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -683,7 +683,7 @@ HashResourceID(XID id, unsigned int numBits)
id &= mask;
if (numBits < 9)
return (id ^ (id >> numBits) ^ (id >> (numBits<<1))) & ~((~0U) << numBits);
- return (id ^ (id >> numBits)) & ~((~0) << numBits);
+ return (id ^ (id >> numBits)) & ~((~0U) << numBits);
}
static XID
commit f12dd2436f2b70dc2fb8e29bee9dfaf907764ca0
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 11:15:03 2024 -0700
dix: ProcListProperties: skip unneeded work if numProps is 0
No real harm, but clears warning from gcc 14.1:
../dix/property.c: In function ‘ProcListProperties’:
..//dix/property.c:605:27: warning: dereference of NULL ‘temppAtoms’
[CWE-476] [-Wanalyzer-null-dereference]
605 | *temppAtoms++ = pProp->propertyName;
| ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 39f337fd497d6fd95efaae9ff5a62d60b49e16aa)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1717>
diff --git a/dix/property.c b/dix/property.c
index f7f9d0943..3eca8615a 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -589,17 +589,20 @@ ProcListProperties(ClientPtr client)
for (pProp = wUserProps(pWin); pProp; pProp = pProp->next)
numProps++;
- if (numProps && !(pAtoms = xallocarray(numProps, sizeof(Atom))))
- return BadAlloc;
-
- numProps = 0;
- temppAtoms = pAtoms;
- for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) {
- realProp = pProp;
- rc = XaceHookPropertyAccess(client, pWin, &realProp, DixGetAttrAccess);
- if (rc == Success && realProp == pProp) {
- *temppAtoms++ = pProp->propertyName;
- numProps++;
+ if (numProps) {
+ pAtoms = xallocarray(numProps, sizeof(Atom));
+ if (!pAtoms)
+ return BadAlloc;
+
+ numProps = 0;
+ temppAtoms = pAtoms;
+ for (pProp = wUserProps(pWin); pProp; pProp = pProp->next) {
+ realProp = pProp;
+ rc = XaceHookPropertyAccess(client, pWin, &realProp, DixGetAttrAccess);
+ if (rc == Success && realProp == pProp) {
+ *temppAtoms++ = pProp->propertyName;
+ numProps++;
+ }
}
}
@@ -613,8 +616,8 @@ ProcListProperties(ClientPtr client)
if (numProps) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
+ free(pAtoms);
}
- free(pAtoms);
return Success;
}
commit 83a9950d7a8e365d13acaa1c38136d1b9068f4be
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 11:03:41 2024 -0700
dix: dixChangeWindowProperty: don't call memcpy if malloc failed
It shouldn't matter, since it would have a length of 0, but it
clears warnings from gcc 14.1:
../dix/property.c: In function ‘dixChangeWindowProperty’:
../dix/property.c:287:9: warning: use of possibly-NULL ‘data’ where
non-null expected [CWE-690] [-Wanalyzer-possible-null-argument]
287 | memcpy(data, value, totalSize);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../dix/property.c:324:13: warning: use of possibly-NULL ‘data’ where
non-null expected [CWE-690] [-Wanalyzer-possible-null-argument]
324 | memcpy(data, value, totalSize);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 10cafd0bbebfbb92c4e73088ba168ef96fcb983c)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1717>
diff --git a/dix/property.c b/dix/property.c
index acce94b2c..f7f9d0943 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -276,11 +276,13 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
if (!pProp)
return BadAlloc;
data = malloc(totalSize);
- if (!data && len) {
- dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
- return BadAlloc;
+ if (totalSize) {
+ if (!data) {
+ dixFreeObjectWithPrivates(pProp, PRIVATE_PROPERTY);
+ return BadAlloc;
+ }
+ memcpy(data, value, totalSize);
}
- memcpy(data, value, totalSize);
pProp->propertyName = property;
pProp->type = type;
pProp->format = format;
@@ -313,9 +315,11 @@ dixChangeWindowProperty(ClientPtr pClient, WindowPtr pWin, Atom property,
if (mode == PropModeReplace) {
data = malloc(totalSize);
- if (!data && len)
- return BadAlloc;
- memcpy(data, value, totalSize);
+ if (totalSize) {
+ if (!data)
+ return BadAlloc;
+ memcpy(data, value, totalSize);
+ }
pProp->data = data;
pProp->size = len;
pProp->type = type;
commit 3bca0f56fa509c57715ad9f2f1742d73f6ffee6d
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 10:41:33 2024 -0700
dix: InitPredictableAccelerationScheme: avoid memory leak on failure
Clears warning from gcc 14.1:
../dix/ptrveloc.c: In function ‘InitPredictableAccelerationScheme’:
../dix/ptrveloc.c:149:9: warning: leak of ‘<unknown>’
[CWE-401] [-Wanalyzer-malloc-leak]
149 | free(vel);
| ^~~~~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 462d13c2f6dc25adea1f19e6b621f97b997236af)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1717>
diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
index 632971ed9..79765e98b 100644
--- a/dix/ptrveloc.c
+++ b/dix/ptrveloc.c
@@ -143,6 +143,7 @@ InitPredictableAccelerationScheme(DeviceIntPtr dev,
schemeData->vel = vel;
scheme.accelData = schemeData;
if (!InitializePredictableAccelerationProperties(dev, vel, schemeData)) {
+ FreeVelocityData(vel);
free(vel);
free(schemeData);
return FALSE;
commit 6cefa3a592ce433a203ddc69e0d5bd1d8a0504fd
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 10:03:08 2024 -0700
dix: CreateScratchGC: avoid dereference of pointer we just set to NULL
Clears warning from gcc 14.1:
../dix/gc.c: In function ‘CreateScratchGC’:
../dix/gc.c:818:28: warning: dereference of NULL ‘pGC’
[CWE-476] [-Wanalyzer-null-dereference]
818 | pGC->graphicsExposures = FALSE;
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 7ee3a520184b355820923bc7a955d0834eb8afbd)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1717>
diff --git a/dix/gc.c b/dix/gc.c
index 4ccbd3b54..0e5de5bd4 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -811,7 +811,8 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth)
FreeGC(pGC, (XID) 0);
pGC = (GCPtr) NULL;
}
- pGC->graphicsExposures = FALSE;
+ else
+ pGC->graphicsExposures = FALSE;
return pGC;
}
commit abaf3c6f204a42006ce1da4fc6d8206477d302e5
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 09:57:36 2024 -0700
dix: enterleave.c: fix implicit fallthrough warnings
Clears 7 -Wimplicit-fallthrough warnings from gcc 14.1
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 0cb826e3d0fd366914c34ab18e5917930f6695b4)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1717>
diff --git a/dix/enterleave.c b/dix/enterleave.c
index 27258c2c2..0e571a880 100644
--- a/dix/enterleave.c
+++ b/dix/enterleave.c
@@ -620,14 +620,19 @@ FixDeviceValuator(DeviceIntPtr dev, deviceValuator * ev, ValuatorClassPtr v,
switch (ev->num_valuators) {
case 6:
ev->valuator5 = v->axisVal[first + 5];
+ /* fallthrough */
case 5:
ev->valuator4 = v->axisVal[first + 4];
+ /* fallthrough */
case 4:
ev->valuator3 = v->axisVal[first + 3];
+ /* fallthrough */
case 3:
ev->valuator2 = v->axisVal[first + 2];
+ /* fallthrough */
case 2:
ev->valuator1 = v->axisVal[first + 1];
+ /* fallthrough */
case 1:
ev->valuator0 = v->axisVal[first];
break;
@@ -666,8 +671,10 @@ FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k,
switch (ev->num_valuators) {
case 3:
ev->valuator2 = v->axisVal[first + 2];
+ /* fallthrough */
case 2:
ev->valuator1 = v->axisVal[first + 1];
+ /* fallthrough */
case 1:
ev->valuator0 = v->axisVal[first];
break;
commit 0f10584ec43eb29512ac9c4748eccc7b1d60988b
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 09:45:54 2024 -0700
dix: SetFontPath: don't set errorValue on Success
Clears warning from gcc 14.1:
../dix/dixfonts.c: In function ‘SetFontPath’:
../dix/dixfonts.c:1697:28: warning: use of uninitialized value ‘bad’
[CWE-457] [-Wanalyzer-use-of-uninitialized-value]
1697 | client->errorValue = bad;
| ~~~~~~~~~~~~~~~~~~~^~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 1a86fba0d9ae2e107e3ed23519ab3b84d2e5240e)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1717>
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 41be4780d..ef7cf2277 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1687,7 +1687,8 @@ SetFontPath(ClientPtr client, int npaths, unsigned char *paths)
int bad;
err = SetFontPathElements(npaths, paths, &bad, FALSE);
- client->errorValue = bad;
+ if (err != Success)
+ client->errorValue = bad;
}
return err;
}
commit f9a5bc6532f76758f7a7fd44047731541ebd23d5
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 09:28:19 2024 -0700
dix: PolyText: fully initialize local_closure
Clears warning from gcc 14.1:
../dix/dixfonts.c:1352:15: warning: use of uninitialized value ‘*c.data’
[CWE-457] [-Wanalyzer-use-of-uninitialized-value]
1352 | free(c->data);
| ~^~~~~~
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit d78836a3a6b827a282957c48898f9ba4cb0dbcf5)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1717>
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 58a385f71..41be4780d 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1352,18 +1352,18 @@ int
PolyText(ClientPtr client, DrawablePtr pDraw, GC * pGC, unsigned char *pElt,
unsigned char *endReq, int xorg, int yorg, int reqType, XID did)
{
- PTclosureRec local_closure;
-
- local_closure.pElt = pElt;
- local_closure.endReq = endReq;
- local_closure.client = client;
- local_closure.pDraw = pDraw;
- local_closure.xorg = xorg;
- local_closure.yorg = yorg;
- local_closure.reqType = reqType;
- local_closure.pGC = pGC;
- local_closure.did = did;
- local_closure.err = Success;
+ PTclosureRec local_closure = {
+ .client = client,
+ .pDraw = pDraw,
+ .pGC = pGC,
+ .pElt = pElt,
+ .endReq = endReq,
+ .xorg = xorg,
+ .yorg = yorg,
+ .reqType = reqType,
+ .did = did,
+ .err = Success
+ };
(void) doPolyText(client, &local_closure);
return Success;
commit 02e6639547361578e856a079814caef08db5260f
Author: Alan Coopersmith <alan.coopersmith at oracle.com>
Date: Sun Sep 8 09:17:17 2024 -0700
dix: check for calloc() failure in Xi event conversion routines
Clears up 12 -Wanalyzer-possible-null-dereference warnings from gcc 14.1
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
(cherry picked from commit 25762834c9a5da3a7c672d89a7da73297252d905)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1717>
diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 53b8c79e3..5364d75d6 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -683,6 +683,8 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
len += vallen * 4; /* valuators mask */
*xi = calloc(1, len);
+ if (*xi == NULL)
+ return BadAlloc;
xde = (xXIDeviceEvent *) * xi;
xde->type = GenericEvent;
xde->extension = IReqCode;
@@ -751,6 +753,8 @@ eventToTouchOwnershipEvent(TouchOwnershipEvent *ev, xEvent **xi)
xXITouchOwnershipEvent *xtoe;
*xi = calloc(1, len);
+ if (*xi == NULL)
+ return BadAlloc;
xtoe = (xXITouchOwnershipEvent *) * xi;
xtoe->type = GenericEvent;
xtoe->extension = IReqCode;
@@ -781,6 +785,8 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
len += vallen * 4; /* valuators mask */
*xi = calloc(1, len);
+ if (*xi == NULL)
+ return BadAlloc;
raw = (xXIRawEvent *) * xi;
raw->type = GenericEvent;
raw->extension = IReqCode;
@@ -816,6 +822,8 @@ eventToBarrierEvent(BarrierEvent *ev, xEvent **xi)
int len = sizeof(xXIBarrierEvent);
*xi = calloc(1, len);
+ if (*xi == NULL)
+ return BadAlloc;
barrier = (xXIBarrierEvent*) *xi;
barrier->type = GenericEvent;
barrier->extension = IReqCode;
@@ -845,6 +853,8 @@ eventToGesturePinchEvent(GestureEvent *ev, xEvent **xi)
xXIGesturePinchEvent *xpe;
*xi = calloc(1, len);
+ if (*xi == NULL)
+ return BadAlloc;
xpe = (xXIGesturePinchEvent *) * xi;
xpe->type = GenericEvent;
xpe->extension = IReqCode;
@@ -887,6 +897,8 @@ eventToGestureSwipeEvent(GestureEvent *ev, xEvent **xi)
xXIGestureSwipeEvent *xde;
*xi = calloc(1, len);
+ if (*xi == NULL)
+ return BadAlloc;
xde = (xXIGestureSwipeEvent *) * xi;
xde->type = GenericEvent;
xde->extension = IReqCode;
commit 111dc7058891bd01b117f3984cf5ac701011e053
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date: Mon Jan 22 14:22:12 2024 +1000
dix: fix valuator copy/paste error in the DeviceStateNotify event
Fixes 219c54b8a3337456ce5270ded6a67bcde53553d5
(cherry picked from commit 133e0d651c5d12bf01999d6289e84e224ba77adc)
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1717>
diff --git a/dix/enterleave.c b/dix/enterleave.c
index 81348148d..27258c2c2 100644
--- a/dix/enterleave.c
+++ b/dix/enterleave.c
@@ -619,11 +619,11 @@ FixDeviceValuator(DeviceIntPtr dev, deviceValuator * ev, ValuatorClassPtr v,
ev->first_valuator = first;
switch (ev->num_valuators) {
case 6:
- ev->valuator2 = v->axisVal[first + 5];
+ ev->valuator5 = v->axisVal[first + 5];
case 5:
- ev->valuator2 = v->axisVal[first + 4];
+ ev->valuator4 = v->axisVal[first + 4];
case 4:
- ev->valuator2 = v->axisVal[first + 3];
+ ev->valuator3 = v->axisVal[first + 3];
case 3:
ev->valuator2 = v->axisVal[first + 2];
case 2:
More information about the xorg-commit
mailing list