From 9c1e83b51b53046c33caa4e47e40ccf0aed4d199 Mon Sep 17 00:00:00 2001 From: Etienne Carriere Date: Tue, 25 Jun 2024 17:14:21 +0200 Subject: [PATCH] fix XCALLOC() against GCC 14 -Wcalloc-transposed-args Fix use of XCALLOC() macro against GCC 14 directive -Wcalloc-transposed-args that makes GCC to complain with an warning/error trace message like the below when 1st argument is given by sizeof(). warning: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args] No functional changes. Signed-off-by: Etienne Carriere --- src/pk/asn1/der/sequence/der_decode_sequence_flexi.c | 2 +- src/pk/asn1/der/sequence/der_decode_sequence_multi.c | 2 +- src/pk/asn1/der/sequence/der_encode_sequence_multi.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pk/asn1/der/sequence/der_decode_sequence_flexi.c b/src/pk/asn1/der/sequence/der_decode_sequence_flexi.c index 2a0841d96..35886cf88 100644 --- a/src/pk/asn1/der/sequence/der_decode_sequence_flexi.c +++ b/src/pk/asn1/der/sequence/der_decode_sequence_flexi.c @@ -268,7 +268,7 @@ static int s_der_decode_sequence_flexi(const unsigned char *in, unsigned long *i } l->size = len; - if ((l->data = XCALLOC(sizeof(wchar_t), l->size)) == NULL) { + if ((l->data = XCALLOC(l->size, sizeof(wchar_t))) == NULL) { err = CRYPT_MEM; goto error; } diff --git a/src/pk/asn1/der/sequence/der_decode_sequence_multi.c b/src/pk/asn1/der/sequence/der_decode_sequence_multi.c index 776c2ed77..5d1c94740 100644 --- a/src/pk/asn1/der/sequence/der_decode_sequence_multi.c +++ b/src/pk/asn1/der/sequence/der_decode_sequence_multi.c @@ -77,7 +77,7 @@ static int s_der_decode_sequence_va(const unsigned char *in, unsigned long inlen return CRYPT_NOP; } - list = XCALLOC(sizeof(*list), x); + list = XCALLOC(x, sizeof(*list)); if (list == NULL) { return CRYPT_MEM; } diff --git a/src/pk/asn1/der/sequence/der_encode_sequence_multi.c b/src/pk/asn1/der/sequence/der_encode_sequence_multi.c index 615488d7c..7758585e6 100644 --- a/src/pk/asn1/der/sequence/der_encode_sequence_multi.c +++ b/src/pk/asn1/der/sequence/der_encode_sequence_multi.c @@ -80,7 +80,7 @@ int der_encode_sequence_multi(unsigned char *out, unsigned long *outlen, ...) return CRYPT_NOP; } - list = XCALLOC(sizeof(*list), x); + list = XCALLOC(x, sizeof(*list)); if (list == NULL) { return CRYPT_MEM; }