From 660146b57ad48f40ca4ea845cc8538500a8d4759 Mon Sep 17 00:00:00 2001 From: Rafael Zalamena Date: Mon, 30 Sep 2024 11:31:56 -0300 Subject: [PATCH] lib: fix calloc warning on recent compiler Fix the following compiler warning: ``` lib/elf_py.c: In function _elffile_load_: lib/elf_py.c:1310:34: warning: _calloc_ sizes specified with _sizeof_ in the earlier argument and not in the later argument [-Wcalloc-transposed-args] 1310 | w->sects = calloc(sizeof(PyObject *), w->ehdr->e_shnum); | ^~~~~~~~ lib/elf_py.c:1310:34: note: earlier argument should specify number of elements, later size of each element ``` Signed-off-by: Rafael Zalamena --- lib/elf_py.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/elf_py.c b/lib/elf_py.c index 2b4fea373f03..6c63d1f89202 100644 --- a/lib/elf_py.c +++ b/lib/elf_py.c @@ -1307,7 +1307,7 @@ static PyObject *elffile_load(PyTypeObject *type, PyObject *args, } #endif - w->sects = calloc(sizeof(PyObject *), w->ehdr->e_shnum); + w->sects = calloc(w->ehdr->e_shnum, sizeof(PyObject *)); w->n_sect = w->ehdr->e_shnum; return (PyObject *)w;