-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Conversation
Unfortunately this compiler complains about a variable potentially being used un-initialized. Silence the warning by initializing it to a sane default. Signed-off-by: Patrick Wildt <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Agree we need backports
Unfortunately this compiler complains about a variable potentially being used un-initialized. Silence the warning by initializing it to a sane default.
PR checklist
Please tick as appropriate and edit the reasons (e.g.: "backport: not needed because this is a new feature")