diff --git a/Xi/listdev.c b/Xi/listdev.c index c15e61b37..e5c3d5e7b 100644 --- a/Xi/listdev.c +++ b/Xi/listdev.c @@ -350,7 +350,7 @@ ProcXListInputDevices(ClientPtr client) }; /* allocate space for saving skip value */ - skip = calloc(sizeof(Bool), inputInfo.numDevices); + skip = calloc(inputInfo.numDevices, sizeof(Bool)); if (!skip) return BadAlloc; diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c index e4731a119..bfcefcd17 100644 --- a/Xi/xiquerydevice.c +++ b/Xi/xiquerydevice.c @@ -88,7 +88,7 @@ ProcXIQueryDevice(ClientPtr client) len += SizeDeviceInfo(dev); } else { - skip = calloc(sizeof(Bool), inputInfo.numDevices); + skip = calloc(inputInfo.numDevices, sizeof(Bool)); if (!skip) return BadAlloc; diff --git a/dix/extension.c b/dix/extension.c index dbe6c0a97..833a6170f 100644 --- a/dix/extension.c +++ b/dix/extension.c @@ -89,7 +89,7 @@ AddExtension(const char *name, int NumEvents, int NumErrors, return ((ExtensionEntry *) NULL); } - ext = calloc(sizeof(ExtensionEntry), 1); + ext = calloc(1, sizeof(ExtensionEntry)); if (!ext) return NULL; if (!dixAllocatePrivates(&ext->devPrivates, PRIVATE_EXTENSION)) { diff --git a/dix/main.c b/dix/main.c index 827f5f260..4980bd6cb 100644 --- a/dix/main.c +++ b/dix/main.c @@ -156,7 +156,7 @@ dix_main(int argc, char *argv[], char *envp[]) CreateWellKnownSockets(); for (i = 1; i < LimitClients; i++) clients[i] = NullClient; - serverClient = calloc(sizeof(ClientRec), 1); + serverClient = calloc(1, sizeof(ClientRec)); if (!serverClient) FatalError("couldn't create server client"); InitClient(serverClient, 0, (void *) NULL); diff --git a/dix/privates.c b/dix/privates.c index 3df845531..2bfedb93b 100644 --- a/dix/privates.c +++ b/dix/privates.c @@ -413,7 +413,7 @@ dixRegisterScreenPrivateKey(DevScreenPrivateKey screenKey, ScreenPtr pScreen, assert(key->type == type); return TRUE; } - key = calloc(sizeof(DevPrivateKeyRec), 1); + key = calloc(1, sizeof(DevPrivateKeyRec)); if (!key) return FALSE; if (!dixRegisterPrivateKey(key, type, size)) { diff --git a/glamor/glamor_egl.c b/glamor/glamor_egl.c index 844dbbe71..86455c407 100644 --- a/glamor/glamor_egl.c +++ b/glamor/glamor_egl.c @@ -1089,7 +1089,7 @@ glamor_egl_init(ScrnInfoPtr scrn, int fd) Bool force_es = FALSE; const char *glvnd_vendor = NULL; - glamor_egl = calloc(sizeof(*glamor_egl), 1); + glamor_egl = calloc(1, sizeof(*glamor_egl)); if (glamor_egl == NULL) return FALSE; if (xf86GlamorEGLPrivateIndex == -1) diff --git a/hw/xwayland/xwayland-glamor-gbm.c b/hw/xwayland/xwayland-glamor-gbm.c index ebc990b57..6a73efe04 100644 --- a/hw/xwayland/xwayland-glamor-gbm.c +++ b/hw/xwayland/xwayland-glamor-gbm.c @@ -1850,7 +1850,7 @@ xwl_glamor_init_gbm(struct xwl_screen *xwl_screen) if (!dixRegisterPrivateKey(&xwl_gbm_private_key, PRIVATE_SCREEN, 0)) return FALSE; - xwl_gbm = calloc(sizeof(*xwl_gbm), 1); + xwl_gbm = calloc(1, sizeof(*xwl_gbm)); if (!xwl_gbm) { ErrorF("glamor: Not enough memory to setup GBM, disabling\n"); return FALSE; diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c index 4b8f22a03..d23f284b9 100644 --- a/hw/xwayland/xwayland-input.c +++ b/hw/xwayland/xwayland-input.c @@ -2870,7 +2870,7 @@ tablet_seat_handle_add_tablet(void *data, struct zwp_tablet_seat_v2 *tablet_seat struct xwl_seat *xwl_seat = data; struct xwl_tablet *xwl_tablet; - xwl_tablet = calloc(sizeof *xwl_tablet, 1); + xwl_tablet = calloc(1, sizeof *xwl_tablet); if (xwl_tablet == NULL) { ErrorF("%s ENOMEM\n", __func__); return; @@ -2901,7 +2901,7 @@ tablet_seat_handle_add_tool(void *data, struct zwp_tablet_seat_v2 *tablet_seat, struct xwl_screen *xwl_screen = xwl_seat->xwl_screen; struct xwl_tablet_tool *xwl_tablet_tool; - xwl_tablet_tool = calloc(sizeof *xwl_tablet_tool, 1); + xwl_tablet_tool = calloc(1, sizeof *xwl_tablet_tool); if (xwl_tablet_tool == NULL) { ErrorF("%s ENOMEM\n", __func__); return; @@ -2924,7 +2924,7 @@ tablet_seat_handle_add_pad(void *data, struct zwp_tablet_seat_v2 *tablet_seat, struct xwl_seat *xwl_seat = data; struct xwl_tablet_pad *xwl_tablet_pad; - xwl_tablet_pad = calloc(sizeof *xwl_tablet_pad, 1); + xwl_tablet_pad = calloc(1, sizeof *xwl_tablet_pad); if (xwl_tablet_pad == NULL) { ErrorF("%s ENOMEM\n", __func__); return; diff --git a/xfixes/cursor.c b/xfixes/cursor.c index 83282ff0e..c34dd9f0f 100644 --- a/xfixes/cursor.c +++ b/xfixes/cursor.c @@ -379,8 +379,8 @@ ProcXFixesGetCursorImage(ClientPtr client) width = pCursor->bits->width; height = pCursor->bits->height; npixels = width * height; - rep = calloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32), - 1); + rep = calloc(1, + sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32)); if (!rep) return BadAlloc; @@ -531,8 +531,8 @@ ProcXFixesGetCursorImageAndName(ClientPtr client) name = pCursor->name ? NameForAtom(pCursor->name) : ""; nbytes = strlen(name); nbytesRound = pad_to_int32(nbytes); - rep = calloc(sizeof(xXFixesGetCursorImageAndNameReply) + - npixels * sizeof(CARD32) + nbytesRound, 1); + rep = calloc(1, sizeof(xXFixesGetCursorImageAndNameReply) + + npixels * sizeof(CARD32) + nbytesRound); if (!rep) return BadAlloc;