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

Fix uninitialized variable in x509_crt (#2392 resubmit) #2795

Merged
merged 1 commit into from
Sep 3, 2019

Conversation

pfalcon
Copy link
Contributor

@pfalcon pfalcon commented Aug 15, 2019

This patch fixes an issue we encountered with more stringent compiler
warnings. The signature_is_good variable has a possibility of being
used uninitialized. This patch moves the use of the variable to a
place where it cannot be used while uninitialized.

Signed-off-by: Andy Gross andy.gross@linaro.org

Backport status: this has been backported to 2.16 in #2813 and is not applicable to 2.7.

Notes:

  • Pull requests cannot be accepted until:
  • This is just a template, so feel free to use/remove the unnecessary things

Description

A few sentences describing the overall goals of the pull request's commits.

Status

READY/IN DEVELOPMENT/HOLD

Requires Backporting

When there is a bug fix, it should be backported to all maintained and supported branches.
Changes do not have to be backported if:

  • This PR is a new feature\enhancement
  • This PR contains changes in the API. If this is true, and there is a need for the fix to be backported, the fix should be handled differently in the legacy branch

Yes | NO
Which branch?

Migrations

If there is any API change, what's the incentive and logic for it.

YES | NO

Additional comments

Any additional information that could be of interest

Todos

  • Tests
  • Documentation
  • Changelog updated
  • Backported

Steps to test or reproduce

Outline the steps to test or reproduce the PR here.

@pfalcon pfalcon changed the title Fix uninitialized variable in x509_crt Fix uninitialized variable in x509_crt (#2392 resubmit) Aug 15, 2019
@pfalcon
Copy link
Contributor Author

pfalcon commented Aug 15, 2019

This is resubmit of #2392, implementing following change request there (#2392 (review)):

Could you remove the double space, and perhaps say something like "Improve code clarity in X.509 module, removing false-positive uninitialized variable warnings on some toolchains."? "Fix compiler warning" is a bit too generic, and it doesn't entail whether the warning was justified and potentially hinting at a serious bug.

Comparing to the original patch, only changes to the ChangeLog file content was made. Everything else: the actual code patch, commit message, sign-off, author - stays the same.

@hanno-arm, @mpg, @RonEld (reviewers of #2392), could you please have a look?

@RonEld RonEld added CLA valid component-x509 needs-backports Backports are missing or are pending review and approval. needs-review Every commit must be reviewed by at least two team members, bug labels Aug 20, 2019
mpg
mpg previously approved these changes Aug 27, 2019
Copy link
Contributor

@mpg mpg left a comment

Choose a reason for hiding this comment

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

I checked that the code changes are identical to those in #2392 which I previously approved.

k-stachowiak
k-stachowiak previously approved these changes Aug 28, 2019
Copy link
Contributor

@k-stachowiak k-stachowiak left a comment

Choose a reason for hiding this comment

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

I went through discussion in the original PR and through the changes. The code looks good.

@mpg mpg removed the needs-review Every commit must be reviewed by at least two team members, label Aug 29, 2019
@mpg
Copy link
Contributor

mpg commented Aug 29, 2019

@pfalcon Thanks for opening this new PR. Could you check if the warning also happens in our LTS branches (currently mbedtls-2.16 and mbedtls-2.7)? If it does, we'll need PRs backporting the fixes to those branches as well. Thanks!

This patch fixes an issue we encountered with more stringent compiler
warnings.  The signature_is_good variable has a possibility of being
used uninitialized.  This patch moves the use of the variable to a
place where it cannot be used while uninitialized.

Signed-off-by: Andy Gross <andy.gross@linaro.org>
@pfalcon pfalcon dismissed stale reviews from k-stachowiak and mpg via 1f62714 August 30, 2019 11:48
@pfalcon
Copy link
Contributor Author

pfalcon commented Aug 30, 2019

@mpg, @k-stachowiak: Thanks for the review!

Could you check if the warning also happens in our LTS branches (currently mbedtls-2.16 and mbedtls-2.7)?

This does happen in 2.16, that's actually which version it was originally prepared for. I submitted #2813 for that, the only change is moving ChangeLog entry to the appropriate section.

While doing so, it occurred to me that this PR contained ChangeLog entry in an old section (circa 2.16.0), so I moved to the next-version section here (while rebasing on the latest development). That dismissed your reviews, sorry about that, hopefully we can recover them soon ;-).

This patch doesn't apply to 2.7 - the code considerably different there.

@Patater Patater requested review from k-stachowiak and mpg August 30, 2019 12:11
Copy link
Contributor

@mpg mpg left a comment

Choose a reason for hiding this comment

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

Thanks for updating! Still looks good to me.

@mpg mpg added the needs-review Every commit must be reviewed by at least two team members, label Sep 2, 2019
@mpg mpg added approved Design and code approved - may be waiting for CI or backports and removed needs-backports Backports are missing or are pending review and approval. needs-review Every commit must be reviewed by at least two team members, labels Sep 2, 2019
@mpg
Copy link
Contributor

mpg commented Sep 2, 2019

This has two approving review, passes CI, and so does the only relevant backport, so labeling "ready for merge".

@Patater Patater merged commit 1f62714 into Mbed-TLS:development Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Design and code approved - may be waiting for CI or backports bug component-x509
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants