Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silence gcc 12.2.0 warning #9139

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/psa_crypto_cipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ const mbedtls_cipher_info_t *mbedtls_cipher_info_from_psa(
{
mbedtls_cipher_mode_t mode;
psa_status_t status;
mbedtls_cipher_id_t cipher_id_tmp;
mbedtls_cipher_id_t cipher_id_tmp = MBEDTLS_CIPHER_ID_NONE;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I and our CI can't reproduce the warning with gcc-12 -Wall -Wextra (which includes -Wmaybe-uninitialized). How did you get it? But explicitly initializing a variable isn't a bad thing anyway.

This code also exists in the mbedtls-3.6 and mbedtls-2.28 branches, so please make backport pull requests to these branches. By the way, please keep the “PR checklist” section in the pull request template, we need it for gatekeeping.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't reproduce this with gcc 12.0.1, so I presume it's new with gcc 12.2

Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my machine and the CI, it's gcc-12 (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0 amd64


status = mbedtls_cipher_values_from_psa(alg, key_type, &key_bits, &mode, &cipher_id_tmp);
if (status != PSA_SUCCESS) {
Expand Down