xserver: Branch 'master' - 11 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Sep 8 23:22:53 UTC 2024
dix/colormap.c | 1 +
dix/devices.c | 2 +-
dix/dixfonts.c | 27 ++++++++++++++-------------
dix/enterleave.c | 7 +++++++
dix/eventconvert.c | 12 ++++++++++++
dix/gc.c | 3 ++-
dix/property.c | 45 ++++++++++++++++++++++++++-------------------
dix/ptrveloc.c | 1 +
dix/resource.c | 2 +-
9 files changed, 65 insertions(+), 35 deletions(-)
New commits:
commit 9c9e1afeb277030380daa9b22f88b05e1af783a0
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>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
diff --git a/dix/colormap.c b/dix/colormap.c
index b7ce8da5e..8dbeed4dc 100644
--- a/dix/colormap.c
+++ b/dix/colormap.c
@@ -1261,6 +1261,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 e6fc0861d8016ab31536329acac6d6de4bc64164
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>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
diff --git a/dix/devices.c b/dix/devices.c
index b4b15a159..d93429e86 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2731,7 +2731,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 26a7ab09eae24fda6cbf51e03f974c7572e80e69
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>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
diff --git a/dix/resource.c b/dix/resource.c
index 356483bac..ffaf1d29d 100644
--- a/dix/resource.c
+++ b/dix/resource.c
@@ -688,7 +688,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 39f337fd497d6fd95efaae9ff5a62d60b49e16aa
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>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
diff --git a/dix/property.c b/dix/property.c
index b51b371f0..501c54698 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -593,17 +593,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++;
+ }
}
}
@@ -617,8 +620,8 @@ ProcListProperties(ClientPtr client)
if (numProps) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, numProps * sizeof(Atom), pAtoms);
+ free(pAtoms);
}
- free(pAtoms);
return Success;
}
commit 10cafd0bbebfbb92c4e73088ba168ef96fcb983c
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>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
diff --git a/dix/property.c b/dix/property.c
index 435450973..b51b371f0 100644
--- a/dix/property.c
+++ b/dix/property.c
@@ -280,11 +280,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;
@@ -317,9 +319,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 462d13c2f6dc25adea1f19e6b621f97b997236af
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>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
index 5166288e8..ee5a24c9e 100644
--- a/dix/ptrveloc.c
+++ b/dix/ptrveloc.c
@@ -146,6 +146,7 @@ InitPredictableAccelerationScheme(DeviceIntPtr dev,
schemeData->vel = vel;
scheme.accelData = schemeData;
if (!InitializePredictableAccelerationProperties(dev, vel, schemeData)) {
+ FreeVelocityData(vel);
free(vel);
free(schemeData);
return FALSE;
commit 7ee3a520184b355820923bc7a955d0834eb8afbd
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>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
diff --git a/dix/gc.c b/dix/gc.c
index b0011127d..a546d3dfa 100644
--- a/dix/gc.c
+++ b/dix/gc.c
@@ -815,7 +815,8 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth)
FreeGC(pGC, (XID) 0);
pGC = (GCPtr) NULL;
}
- pGC->graphicsExposures = FALSE;
+ else
+ pGC->graphicsExposures = FALSE;
return pGC;
}
commit 0cb826e3d0fd366914c34ab18e5917930f6695b4
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>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
diff --git a/dix/enterleave.c b/dix/enterleave.c
index cb6209c1d..f12e8e1ed 100644
--- a/dix/enterleave.c
+++ b/dix/enterleave.c
@@ -624,14 +624,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;
@@ -670,8 +675,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 1a86fba0d9ae2e107e3ed23519ab3b84d2e5240e
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>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 9fc6ddaf4..ec0c41c76 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1694,7 +1694,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 d78836a3a6b827a282957c48898f9ba4cb0dbcf5
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>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index b85c5d282..9fc6ddaf4 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1359,18 +1359,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 25762834c9a5da3a7c672d89a7da73297252d905
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>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1673>
diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index a7f43efe6..6abd86836 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -685,6 +685,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;
@@ -753,6 +755,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;
@@ -783,6 +787,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;
@@ -818,6 +824,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;
@@ -847,6 +855,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;
@@ -889,6 +899,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;
More information about the xorg-commit
mailing list