Standard signature is 'calloc(n_elems, elem_size)', where element size
(in particular, when using 'sizeof') comes as 2nd arg. The actual
allocation size does not care for ordering but swapping the order
confuses static-analysis tools like Coverity, as well as naive readers.
Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Shweta Sodani <ssodani@redhat.com>
Reviewed-by: Rabinarayan Panigrahi <rapanigr@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Tue Aug 19 18:08:02 UTC 2025 on atb-devel-224
goto done;
}
- pids = (pid_t *)calloc(sizeof(pid_t), num_procs);
+ pids = (pid_t *)calloc(num_procs, sizeof(pid_t));
if (pids == NULL) {
perror("Unable to allocate memory for pids");
exit(1);
}
- done = (int *)calloc(sizeof(int), num_procs);
+ done = (int *)calloc(num_procs, sizeof(int));
if (done == NULL) {
perror("Unable to allocate memory for done");
exit(1);