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

bootutil: Fix signed/unsigned comparison in boot_read_enc_key #1958

Merged

Conversation

taltenbach
Copy link
Contributor

When MCUBOOT_SWAP_SAVE_ENCTLV is enabled, a comparison between a signed and an unsigned integer is made in boot_read_enc_key. This shouldn't cause any issue at runtime but might lead to a warning to be emitted at compile-time.

In particular, with GCC, if -Wsign-compare is enabled:

MCUboot/boot/bootutil/src/bootutil_misc.c:279:23: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
         for (i = 0; i < BOOT_ENC_TLV_ALIGN_SIZE; i++) {
                       ^

When MCUBOOT_SWAP_SAVE_ENCTLV is enabled, a comparison between a signed
and an unsigned integer is made in boot_read_enc_key. This might cause a
warning to be emitted at compile-time.

Signed-off-by: Thomas Altenbach <thomas.altenbach@legrand.com>
@utzig utzig merged commit 9ae634f into mcu-tools:main Jun 20, 2024
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants