L2CAP sm: do not discard alignment information.#252
Merged
andrzej-kaczmarek merged 1 commit intoapache:masterfrom Dec 4, 2018
Merged
L2CAP sm: do not discard alignment information.#252andrzej-kaczmarek merged 1 commit intoapache:masterfrom
andrzej-kaczmarek merged 1 commit intoapache:masterfrom
Conversation
ble_sm_gen_ediv and ble_sm_gen_master_id_rand took a simple pointer to integers, but were being called with pointers to members of a packed struct. This discarded the alignment information. Not only did it produce an error with clang's -Wno-address-of-packed-member, but it may also cause an error in a platform with alignment requirements. The solution was to modify both procedures to take a pointer to the whole structure instead of only the members.
jcarrano
added a commit
to jcarrano/RIOT
that referenced
this pull request
Nov 29, 2018
Nimble contains a couple of casts that discard alignment information. This causes a warning with clang's -Wno-address-of-packed-member. A previous PR (RIOT-OS#10503) supressed that warning. This commit re-enables them and provides a patch to fix the offending code. The fix has been submitted upstream, see apache/mynewt-nimble#252
crest42
pushed a commit
to crest42/RIOT
that referenced
this pull request
Dec 18, 2018
Nimble contains a couple of casts that discard alignment information. This causes a warning with clang's -Wno-address-of-packed-member. A previous PR (RIOT-OS#10503) supressed that warning. This commit re-enables them and provides a patch to fix the offending code. The fix has been submitted upstream, see apache/mynewt-nimble#252
BytesGalore
pushed a commit
to BytesGalore/RIOT
that referenced
this pull request
Jan 29, 2019
Nimble contains a couple of casts that discard alignment information. This causes a warning with clang's -Wno-address-of-packed-member. A previous PR (RIOT-OS#10503) supressed that warning. This commit re-enables them and provides a patch to fix the offending code. The fix has been submitted upstream, see apache/mynewt-nimble#252
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
ble_sm_gen_edivandble_sm_gen_master_id_randtook a simple pointer to integers, but were being called with pointers to members of a packed struct. This discarded the alignment information.Not only did it produce an error with clang's -Wno-address-of-packed-member, but it may also cause an error in a platform with alignment requirements.
The solution was to modify both procedures to take a pointer to the whole structure instead of only the members.
This is my first contribution to this project, so please excuse if there is anything not OK with the commit/pr.
How to test
Compile with clang, with the
-Wno-address-of-packed-member. The warning should be gone with this patch.