[PATCH ulogd2 1/2] nfct: fix calloc argument order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 input/flow/ulogd_inpflow_NFCT.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/input/flow/ulogd_inpflow_NFCT.c b/input/flow/ulogd_inpflow_NFCT.c
index 899b7e3..5ac24e5 100644
--- a/input/flow/ulogd_inpflow_NFCT.c
+++ b/input/flow/ulogd_inpflow_NFCT.c
@@ -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;

--
2.48.1





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux