]> git.ipfire.org Git - thirdparty/ulogd2.git/commitdiff
nfct: fix calloc argument order
authorCorubba Smith <corubba@gmx.de>
Sat, 8 Mar 2025 21:27:56 +0000 (22:27 +0100)
committerFlorian Westphal <fw@strlen.de>
Sun, 9 Mar 2025 11:19:12 +0000 (12:19 +0100)
The first argument to calloc() is the number of elements, the second is
the size of a single element. Having the arguments switched shouldn't
make any difference during runtime, but GCC warns about it when using
-Wcalloc-transposed-args [0].

[0] https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wcalloc-transposed-args

Signed-off-by: Corubba Smith <corubba@gmx.de>
Signed-off-by: Florian Westphal <fw@strlen.de>
input/flow/ulogd_inpflow_NFCT.c

index 899b7e3b80399cdf92df2827af50f9761880f586..5ac24e5732bd2c994331cfee5b767b7e12020aa5 100644 (file)
@@ -660,7 +660,7 @@ event_handler_hashtable(enum nf_conntrack_msg_type type,
 
        switch(type) {
        case NFCT_T_NEW:
-               ts = calloc(sizeof(struct ct_timestamp), 1);
+               ts = calloc(1, sizeof(struct ct_timestamp));
                if (ts == NULL)
                        return NFCT_CB_CONTINUE;
 
@@ -681,7 +681,7 @@ event_handler_hashtable(enum nf_conntrack_msg_type type,
                if (ts)
                        nfct_copy(ts->ct, ct, NFCT_CP_META);
                else {
-                       ts = calloc(sizeof(struct ct_timestamp), 1);
+                       ts = calloc(1, sizeof(struct ct_timestamp));
                        if (ts == NULL)
                                return NFCT_CB_CONTINUE;
 
@@ -771,7 +771,7 @@ polling_handler(enum nf_conntrack_msg_type type,
                if (ts)
                        nfct_copy(ts->ct, ct, NFCT_CP_META);
                else {
-                       ts = calloc(sizeof(struct ct_timestamp), 1);
+                       ts = calloc(1, sizeof(struct ct_timestamp));
                        if (ts == NULL)
                                return NFCT_CB_CONTINUE;
 
@@ -908,7 +908,7 @@ static int overrun_handler(enum nf_conntrack_msg_type type,
        ts = (struct ct_timestamp *)
                hashtable_find(cpi->ct_active, ct, id);
        if (ts == NULL) {
-               ts = calloc(sizeof(struct ct_timestamp), 1);
+               ts = calloc(1, sizeof(struct ct_timestamp));
                if (ts == NULL)
                        return NFCT_CB_CONTINUE;
 
@@ -971,7 +971,7 @@ dump_reset_handler(enum nf_conntrack_msg_type type,
                if (ts)
                        nfct_copy(ts->ct, ct, NFCT_CP_META);
                else {
-                       ts = calloc(sizeof(struct ct_timestamp), 1);
+                       ts = calloc(1, sizeof(struct ct_timestamp));
                        if (ts == NULL)
                                return NFCT_CB_CONTINUE;