Skip to content

Commit

Permalink
libtomcrypt: fix calloc() against GCC 14 -Wcalloc-transposed-args
Browse files Browse the repository at this point in the history
Fix use of XCALLOC() macro against GCC 14 directive
-Wcalloc-transposed-args that makes GCC to complain with an warning/error
trace message like:

warning: 'calloc' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Wcalloc-transposed-args]

This change was proposed and merged in mainline libtomcrypt repository.

No functional change.

Link: libtom/libtomcrypt#647
Signed-off-by: Etienne Carriere <[email protected]>
Acked-by: Gatien Chevallier <[email protected]>
Reviewed-by: Jerome Forissier <[email protected]>
  • Loading branch information
etienne-lms committed Jun 27, 2024
1 parent c64eedb commit eca12ca
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,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;
}
Expand Down

0 comments on commit eca12ca

Please sign in to comment.