Xi: drop swapping request length fields

The request struct's length fields aren't used anymore - we have the
client->req_len field instead, which also is bigreq-compatible.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1639>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-08-06 17:02:20 +02:00 committed by Marge Bot
parent 54d4dd619c
commit 4d053f22f3
54 changed files with 43 additions and 88 deletions

View File

@ -72,7 +72,6 @@ int _X_COLD
SProcXAllowDeviceEvents(ClientPtr client)
{
REQUEST(xAllowDeviceEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xAllowDeviceEventsReq);
swapl(&stuff->time);
return (ProcXAllowDeviceEvents(client));

View File

@ -76,7 +76,6 @@ SProcXChangeDeviceControl(ClientPtr client)
xDeviceCtl *ctl;
REQUEST(xChangeDeviceControlReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_EXTRA_SIZE(xChangeDeviceControlReq, sizeof(xDeviceCtl));
swaps(&stuff->control);
ctl = (xDeviceCtl *) &stuff[1];

View File

@ -73,7 +73,6 @@ int _X_COLD
SProcXChangeFeedbackControl(ClientPtr client)
{
REQUEST(xChangeFeedbackControlReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq);
swapl(&stuff->mask);
return (ProcXChangeFeedbackControl(client));

View File

@ -73,9 +73,6 @@ SOFTWARE.
int _X_COLD
SProcXChangeKeyboardDevice(ClientPtr client)
{
REQUEST(xChangeKeyboardDeviceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xChangeKeyboardDeviceReq);
return (ProcXChangeKeyboardDevice(client));
}

View File

@ -75,7 +75,6 @@ SProcXChangeDeviceKeyMapping(ClientPtr client)
unsigned int count;
REQUEST(xChangeDeviceKeyMappingReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq);
count = stuff->keyCodes * stuff->keySymsPerKeyCode;
REQUEST_FIXED_SIZE(xChangeDeviceKeyMappingReq, count * sizeof(CARD32));

View File

@ -75,7 +75,6 @@ int _X_COLD
SProcXChangeDeviceDontPropagateList(ClientPtr client)
{
REQUEST(xChangeDeviceDontPropagateListReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xChangeDeviceDontPropagateListReq);
swapl(&stuff->window);
swaps(&stuff->count);

View File

@ -75,9 +75,6 @@ SOFTWARE.
int _X_COLD
SProcXChangePointerDevice(ClientPtr client)
{
REQUEST(xChangePointerDeviceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xChangePointerDeviceReq);
return (ProcXChangePointerDevice(client));
}

View File

@ -71,9 +71,6 @@ SOFTWARE.
int _X_COLD
SProcXCloseDevice(ClientPtr client)
{
REQUEST(xCloseDeviceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xCloseDeviceReq);
return (ProcXCloseDevice(client));
}

View File

@ -69,8 +69,6 @@ SOFTWARE.
int _X_COLD
SProcXDeviceBell(ClientPtr client)
{
REQUEST(xDeviceBellReq);
swaps(&stuff->length);
return (ProcXDeviceBell(client));
}

View File

@ -68,8 +68,6 @@ SOFTWARE.
int _X_COLD
SProcXGetDeviceButtonMapping(ClientPtr client)
{
REQUEST(xGetDeviceButtonMappingReq);
swaps(&stuff->length);
return (ProcXGetDeviceButtonMapping(client));
}

View File

@ -70,7 +70,6 @@ int _X_COLD
SProcXGetDeviceControl(ClientPtr client)
{
REQUEST(xGetDeviceControlReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceControlReq);
swaps(&stuff->control);
return (ProcXGetDeviceControl(client));

View File

@ -69,8 +69,6 @@ SOFTWARE.
int _X_COLD
SProcXGetFeedbackControl(ClientPtr client)
{
REQUEST(xGetFeedbackControlReq);
swaps(&stuff->length);
return (ProcXGetFeedbackControl(client));
}

View File

@ -69,8 +69,6 @@ SOFTWARE.
int _X_COLD
SProcXGetDeviceFocus(ClientPtr client)
{
REQUEST(xGetDeviceFocusReq);
swaps(&stuff->length);
return (ProcXGetDeviceFocus(client));
}

View File

@ -72,8 +72,6 @@ SOFTWARE.
int _X_COLD
SProcXGetDeviceKeyMapping(ClientPtr client)
{
REQUEST(xGetDeviceKeyMappingReq);
swaps(&stuff->length);
return (ProcXGetDeviceKeyMapping(client));
}

View File

@ -69,8 +69,6 @@ SOFTWARE.
int _X_COLD
SProcXGetDeviceModifierMapping(ClientPtr client)
{
REQUEST(xGetDeviceModifierMappingReq);
swaps(&stuff->length);
return (ProcXGetDeviceModifierMapping(client));
}

View File

@ -76,7 +76,6 @@ int _X_COLD
SProcXGetDeviceDontPropagateList(ClientPtr client)
{
REQUEST(xGetDeviceDontPropagateListReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq);
swapl(&stuff->window);
return (ProcXGetDeviceDontPropagateList(client));

View File

@ -74,7 +74,6 @@ int _X_COLD
SProcXGetSelectedExtensionEvents(ClientPtr client)
{
REQUEST(xGetSelectedExtensionEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq);
swapl(&stuff->window);
return (ProcXGetSelectedExtensionEvents(client));

View File

@ -72,7 +72,6 @@ int _X_COLD
SProcXGetExtensionVersion(ClientPtr client)
{
REQUEST(xGetExtensionVersionReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGetExtensionVersionReq);
swaps(&stuff->nbytes);
return (ProcXGetExtensionVersion(client));

View File

@ -76,7 +76,6 @@ int _X_COLD
SProcXGrabDevice(ClientPtr client)
{
REQUEST(xGrabDeviceReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceReq);
swapl(&stuff->grabWindow);
swapl(&stuff->time);

View File

@ -74,7 +74,6 @@ int _X_COLD
SProcXGrabDeviceButton(ClientPtr client)
{
REQUEST(xGrabDeviceButtonReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceButtonReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);

View File

@ -74,7 +74,6 @@ int _X_COLD
SProcXGrabDeviceKey(ClientPtr client)
{
REQUEST(xGrabDeviceKeyReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xGrabDeviceKeyReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);

View File

@ -71,7 +71,6 @@ int _X_COLD
SProcXGetDeviceMotionEvents(ClientPtr client)
{
REQUEST(xGetDeviceMotionEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq);
swapl(&stuff->start);
swapl(&stuff->stop);

View File

@ -77,8 +77,6 @@ SOFTWARE.
int _X_COLD
SProcXListInputDevices(ClientPtr client)
{
REQUEST(xListInputDevicesReq);
swaps(&stuff->length);
return (ProcXListInputDevices(client));
}

View File

@ -74,8 +74,6 @@ extern CARD8 event_base[];
int _X_COLD
SProcXOpenDevice(ClientPtr client)
{
REQUEST(xOpenDeviceReq);
swaps(&stuff->length);
return (ProcXOpenDevice(client));
}

View File

@ -56,8 +56,6 @@ from The Open Group.
int _X_COLD
SProcXQueryDeviceState(ClientPtr client)
{
REQUEST(xQueryDeviceStateReq);
swaps(&stuff->length);
return (ProcXQueryDeviceState(client));
}

View File

@ -121,7 +121,6 @@ int _X_COLD
SProcXSelectExtensionEvent(ClientPtr client)
{
REQUEST(xSelectExtensionEventReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSelectExtensionEventReq);
swapl(&stuff->window);
swaps(&stuff->count);

View File

@ -82,7 +82,6 @@ SProcXSendExtensionEvent(ClientPtr client)
EventSwapPtr proc;
REQUEST(xSendExtensionEventReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xSendExtensionEventReq);
swapl(&stuff->destination);
swaps(&stuff->count);

View File

@ -71,8 +71,6 @@ SOFTWARE.
int _X_COLD
SProcXSetDeviceButtonMapping(ClientPtr client)
{
REQUEST(xSetDeviceButtonMappingReq);
swaps(&stuff->length);
return (ProcXSetDeviceButtonMapping(client));
}

View File

@ -71,8 +71,6 @@ SOFTWARE.
int _X_COLD
SProcXSetDeviceValuators(ClientPtr client)
{
REQUEST(xSetDeviceValuatorsReq);
swaps(&stuff->length);
return (ProcXSetDeviceValuators(client));
}

View File

@ -74,7 +74,6 @@ int _X_COLD
SProcXSetDeviceFocus(ClientPtr client)
{
REQUEST(xSetDeviceFocusReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xSetDeviceFocusReq);
swapl(&stuff->focus);
swapl(&stuff->time);

View File

@ -73,8 +73,6 @@ SOFTWARE.
int _X_COLD
SProcXSetDeviceModifierMapping(ClientPtr client)
{
REQUEST(xSetDeviceModifierMappingReq);
swaps(&stuff->length);
return (ProcXSetDeviceModifierMapping(client));
}

View File

@ -71,8 +71,6 @@ SOFTWARE.
int _X_COLD
SProcXSetDeviceMode(ClientPtr client)
{
REQUEST(xSetDeviceModeReq);
swaps(&stuff->length);
return (ProcXSetDeviceMode(client));
}

View File

@ -69,7 +69,6 @@ int _X_COLD
SProcXUngrabDevice(ClientPtr client)
{
REQUEST(xUngrabDeviceReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xUngrabDeviceReq);
swapl(&stuff->time);
return (ProcXUngrabDevice(client));

View File

@ -77,7 +77,6 @@ int _X_COLD
SProcXUngrabDeviceButton(ClientPtr client)
{
REQUEST(xUngrabDeviceButtonReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);

View File

@ -79,7 +79,6 @@ int _X_COLD
SProcXUngrabDeviceKey(ClientPtr client)
{
REQUEST(xUngrabDeviceKeyReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq);
swapl(&stuff->grabWindow);
swaps(&stuff->modifiers);

View File

@ -51,7 +51,6 @@ SProcXIAllowEvents(ClientPtr client)
REQUEST(xXIAllowEventsReq);
REQUEST_AT_LEAST_SIZE(xXIAllowEventsReq);
swaps(&stuff->length);
swaps(&stuff->deviceid);
swapl(&stuff->time);
if (client->req_len > 3) {

View File

@ -842,7 +842,6 @@ SProcXIBarrierReleasePointer(ClientPtr client)
REQUEST(xXIBarrierReleasePointerReq);
int i;
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXIBarrierReleasePointerReq);
swapl(&stuff->num_barriers);

View File

@ -59,7 +59,6 @@ SProcXIChangeCursor(ClientPtr client)
{
REQUEST(xXIChangeCursorReq);
REQUEST_SIZE_MATCH(xXIChangeCursorReq);
swaps(&stuff->length);
swapl(&stuff->win);
swapl(&stuff->cursor);
swaps(&stuff->deviceid);

View File

@ -131,8 +131,6 @@ XISendDeviceHierarchyEvent(int flags[MAXDEVICES])
int _X_COLD
SProcXIChangeHierarchy(ClientPtr client)
{
REQUEST(xXIChangeHierarchyReq);
swaps(&stuff->length);
return (ProcXIChangeHierarchy(client));
}

View File

@ -52,7 +52,6 @@ SProcXIGetClientPointer(ClientPtr client)
REQUEST(xXIGetClientPointerReq);
REQUEST_SIZE_MATCH(xXIGetClientPointerReq);
swaps(&stuff->length);
swapl(&stuff->win);
return ProcXIGetClientPointer(client);
}

View File

@ -53,7 +53,6 @@ SProcXIGrabDevice(ClientPtr client)
*/
REQUEST_AT_LEAST_SIZE(xXIGrabDeviceReq);
swaps(&stuff->length);
swaps(&stuff->deviceid);
swapl(&stuff->grab_window);
swapl(&stuff->cursor);
@ -138,7 +137,6 @@ SProcXIUngrabDevice(ClientPtr client)
REQUEST(xXIUngrabDeviceReq);
REQUEST_SIZE_MATCH(xXIUngrabDeviceReq);
swaps(&stuff->length);
swaps(&stuff->deviceid);
swapl(&stuff->time);

View File

@ -55,7 +55,6 @@ SProcXIPassiveGrabDevice(ClientPtr client)
REQUEST(xXIPassiveGrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xXIPassiveGrabDeviceReq);
swaps(&stuff->length);
swaps(&stuff->deviceid);
swapl(&stuff->grab_window);
swapl(&stuff->cursor);
@ -280,7 +279,6 @@ SProcXIPassiveUngrabDevice(ClientPtr client)
REQUEST(xXIPassiveUngrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xXIPassiveUngrabDeviceReq);
swaps(&stuff->length);
swapl(&stuff->grab_window);
swaps(&stuff->deviceid);
swapl(&stuff->detail);

View File

@ -1016,10 +1016,6 @@ ProcXGetDeviceProperty(ClientPtr client)
int _X_COLD
SProcXListDeviceProperties(ClientPtr client)
{
REQUEST(xListDevicePropertiesReq);
REQUEST_SIZE_MATCH(xListDevicePropertiesReq);
swaps(&stuff->length);
return (ProcXListDeviceProperties(client));
}
@ -1029,7 +1025,6 @@ SProcXChangeDeviceProperty(ClientPtr client)
REQUEST(xChangeDevicePropertyReq);
REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
swaps(&stuff->length);
swapl(&stuff->property);
swapl(&stuff->type);
swapl(&stuff->nUnits);
@ -1042,7 +1037,6 @@ SProcXDeleteDeviceProperty(ClientPtr client)
REQUEST(xDeleteDevicePropertyReq);
REQUEST_SIZE_MATCH(xDeleteDevicePropertyReq);
swaps(&stuff->length);
swapl(&stuff->property);
return (ProcXDeleteDeviceProperty(client));
}
@ -1053,7 +1047,6 @@ SProcXGetDeviceProperty(ClientPtr client)
REQUEST(xGetDevicePropertyReq);
REQUEST_SIZE_MATCH(xGetDevicePropertyReq);
swaps(&stuff->length);
swapl(&stuff->property);
swapl(&stuff->type);
swapl(&stuff->longOffset);
@ -1261,7 +1254,6 @@ SProcXIListProperties(ClientPtr client)
REQUEST(xXIListPropertiesReq);
REQUEST_SIZE_MATCH(xXIListPropertiesReq);
swaps(&stuff->length);
swaps(&stuff->deviceid);
return (ProcXIListProperties(client));
}
@ -1272,7 +1264,6 @@ SProcXIChangeProperty(ClientPtr client)
REQUEST(xXIChangePropertyReq);
REQUEST_AT_LEAST_SIZE(xXIChangePropertyReq);
swaps(&stuff->length);
swaps(&stuff->deviceid);
swapl(&stuff->property);
swapl(&stuff->type);
@ -1286,7 +1277,6 @@ SProcXIDeleteProperty(ClientPtr client)
REQUEST(xXIDeletePropertyReq);
REQUEST_SIZE_MATCH(xXIDeletePropertyReq);
swaps(&stuff->length);
swaps(&stuff->deviceid);
swapl(&stuff->property);
return (ProcXIDeleteProperty(client));
@ -1298,7 +1288,6 @@ SProcXIGetProperty(ClientPtr client)
REQUEST(xXIGetPropertyReq);
REQUEST_SIZE_MATCH(xXIGetPropertyReq);
swaps(&stuff->length);
swaps(&stuff->deviceid);
swapl(&stuff->property);
swapl(&stuff->type);

View File

@ -58,7 +58,6 @@ SProcXIQueryDevice(ClientPtr client)
REQUEST(xXIQueryDeviceReq);
REQUEST_SIZE_MATCH(xXIQueryDeviceReq);
swaps(&stuff->length);
swaps(&stuff->deviceid);
return ProcXIQueryDevice(client);

View File

@ -67,7 +67,6 @@ SProcXIQueryPointer(ClientPtr client)
REQUEST(xXIQueryPointerReq);
REQUEST_SIZE_MATCH(xXIQueryPointerReq);
swaps(&stuff->length);
swaps(&stuff->deviceid);
swapl(&stuff->win);
return (ProcXIQueryPointer(client));

View File

@ -133,7 +133,6 @@ int _X_COLD
SProcXIQueryVersion(ClientPtr client)
{
REQUEST(xXIQueryVersionReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXIQueryVersionReq);
swaps(&stuff->major_version);
swaps(&stuff->minor_version);

View File

@ -120,7 +120,6 @@ SProcXISelectEvents(ClientPtr client)
xXIEventMask *evmask;
REQUEST(xXISelectEventsReq);
swaps(&stuff->length);
REQUEST_AT_LEAST_SIZE(xXISelectEventsReq);
swapl(&stuff->win);
swaps(&stuff->num_masks);
@ -331,7 +330,6 @@ int _X_COLD
SProcXIGetSelectedEvents(ClientPtr client)
{
REQUEST(xXIGetSelectedEventsReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xXIGetSelectedEventsReq);
swapl(&stuff->win);

View File

@ -53,7 +53,6 @@ SProcXISetClientPointer(ClientPtr client)
REQUEST(xXISetClientPointerReq);
REQUEST_SIZE_MATCH(xXISetClientPointerReq);
swaps(&stuff->length);
swapl(&stuff->win);
swaps(&stuff->deviceid);
return (ProcXISetClientPointer(client));

View File

@ -46,7 +46,6 @@ SProcXISetFocus(ClientPtr client)
REQUEST(xXISetFocusReq);
REQUEST_AT_LEAST_SIZE(xXISetFocusReq);
swaps(&stuff->length);
swaps(&stuff->deviceid);
swapl(&stuff->focus);
swapl(&stuff->time);
@ -60,7 +59,6 @@ SProcXIGetFocus(ClientPtr client)
REQUEST(xXIGetFocusReq);
REQUEST_AT_LEAST_SIZE(xXIGetFocusReq);
swaps(&stuff->length);
swaps(&stuff->deviceid);
return ProcXIGetFocus(client);

View File

@ -61,7 +61,6 @@ SProcXIWarpPointer(ClientPtr client)
REQUEST(xXIWarpPointerReq);
REQUEST_SIZE_MATCH(xXIWarpPointerReq);
swaps(&stuff->length);
swapl(&stuff->src_win);
swapl(&stuff->dst_win);
swapl(&stuff->src_x);

View File

@ -139,8 +139,18 @@ request_XIGetSelectedEvents(xXIGetSelectedEventsReq * req, int error)
wrapped_WriteToClient = reply_XIGetSelectedEvents;
client.swapped = TRUE;
/* MUST NOT swap req->length here !
The handler proc's don't use that field anymore, thus also SProc's
wont swap it. But this test program uses that field to initialize
client->req_len (see above). We previously had to swap it here, so
that SProcXIPassiveGrabDevice() will swap it back. Since that's gone
now, still swapping itself would break if this function is called
again and writing back a errornously swapped value
*/
swapl(&req->win);
swaps(&req->length);
rc = SProcXIGetSelectedEvents(&client);
assert(rc == error);
}

View File

@ -144,7 +144,17 @@ request_XIPassiveGrabDevice(ClientPtr client, xXIPassiveGrabDeviceReq * req,
assert(client_request.errorValue == errval);
client_request.swapped = TRUE;
swaps(&req->length);
/* MUST NOT swap req->length here !
The handler proc's don't use that field anymore, thus also SProc's
wont swap it. But this test program uses that field to initialize
client->req_len (see above). We previously had to swap it here, so
that SProcXIPassiveGrabDevice() will swap it back. Since that's gone
now, still swapping itself would break if this function is called
again and writing back a errornously swapped value
*/
swapl(&req->time);
swapl(&req->grab_window);
swapl(&req->cursor);

View File

@ -107,8 +107,17 @@ request_XISelectEvent(xXISelectEventsReq * req, int error)
mask = next;
}
/* MUST NOT swap req->length here !
The handler proc's don't use that field anymore, thus also SProc's
wont swap it. But this test program uses that field to initialize
client->req_len (see above). We previously had to swap it here, so
that SProcXIPassiveGrabDevice() will swap it back. Since that's gone
now, still swapping itself would break if this function is called
again and writing back a errornously swapped value
*/
swapl(&req->win);
swaps(&req->length);
swaps(&req->num_masks);
rc = SProcXISelectEvents(&client);
assert(rc == error);

View File

@ -66,8 +66,18 @@ request_XISetClientPointer(xXISetClientPointerReq * req, int error)
assert(client_request.errorValue == req->deviceid);
client_request.swapped = TRUE;
/* MUST NOT swap req->length here !
The handler proc's don't use that field anymore, thus also SProc's
wont swap it. But this test program uses that field to initialize
client->req_len (see above). We previously had to swap it here, so
that SProcXIPassiveGrabDevice() will swap it back. Since that's gone
now, still swapping itself would break if this function is called
again and writing back a errornously swapped value
*/
swapl(&req->win);
swaps(&req->length);
swaps(&req->deviceid);
rc = SProcXISetClientPointer(&client_request);
assert(rc == error);