Commit 7812b20ad5 for openssl.org
commit 7812b20ad590c110b0d4118c03f201e925dd43a1
Author: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com>
Date: Sat Jul 4 11:59:35 2026 +0200
Add parentheses around sizeof arguments
Found by running the checkpatch.pl Linux script to enforce coding style.
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
MergeDate: Wed Jul 8 10:11:18 2026
(Merged from https://github.com/openssl/openssl/pull/31860)
diff --git a/crypto/x509/x509_vpm.c b/crypto/x509/x509_vpm.c
index f0858e357e..44b116923b 100644
--- a/crypto/x509/x509_vpm.c
+++ b/crypto/x509/x509_vpm.c
@@ -35,7 +35,7 @@ static X509_BUFFER *buffer_from_bytes(const uint8_t *bytes, size_t length)
{
X509_BUFFER *buf;
- if ((buf = OPENSSL_zalloc(sizeof *buf)) != NULL
+ if ((buf = OPENSSL_zalloc(sizeof(*buf))) != NULL
&& (buf->data = OPENSSL_memdup(bytes, length)) != NULL) {
buf->len = length;
} else {
@@ -56,7 +56,7 @@ static X509_BUFFER *buffer_from_string(const uint8_t *bytes, size_t length)
X509_BUFFER *buf, *ret = NULL;
uint8_t *data = NULL;
- if ((buf = OPENSSL_zalloc(sizeof *buf)) == NULL)
+ if ((buf = OPENSSL_zalloc(sizeof(*buf))) == NULL)
goto err;
if ((data = (uint8_t *)OPENSSL_strndup((char *)bytes, length)) == NULL)
diff --git a/test/asn1_internal_test.c b/test/asn1_internal_test.c
index 1f6785cda3..469daafc4c 100644
--- a/test/asn1_internal_test.c
+++ b/test/asn1_internal_test.c
@@ -185,9 +185,9 @@ static int test_unicode_range(void)
"\xff\xff\xff\xff";
int ok = 1;
- if (!test_unicode(univ_ok, sizeof univ_ok - 1, V_ASN1_UTF8STRING))
+ if (!test_unicode(univ_ok, sizeof(univ_ok) - 1, V_ASN1_UTF8STRING))
ok = 0;
- if (!test_unicode(univ_bad, sizeof univ_bad - 1, -1))
+ if (!test_unicode(univ_bad, sizeof(univ_bad) - 1, -1))
ok = 0;
return ok;
}
diff --git a/test/pkcs7_test.c b/test/pkcs7_test.c
index 3fe68f60aa..8514101121 100644
--- a/test/pkcs7_test.c
+++ b/test/pkcs7_test.c
@@ -385,10 +385,10 @@ static int pkcs7_inner_content_verify_test(void)
0x2D, 0x6F, 0x81
};
- if (!TEST_ptr(bio = BIO_new_mem_buf(sig_der, sizeof sig_der)))
+ if (!TEST_ptr(bio = BIO_new_mem_buf(sig_der, sizeof(sig_der))))
goto end;
- ret = TEST_ptr(x509_bio = BIO_new_mem_buf(smroot_der, sizeof smroot_der))
+ ret = TEST_ptr(x509_bio = BIO_new_mem_buf(smroot_der, sizeof(smroot_der)))
&& TEST_ptr(cert = d2i_X509_bio(x509_bio, NULL))
&& TEST_int_eq(ERR_peek_error(), 0)
&& TEST_ptr(store = X509_STORE_new())