mmcsd: fix a logic error#13528
Merged
Merged
Conversation
Member
|
[Experimental Bot, please feedback here] The provided PR summary does not meet the NuttX requirements. Here's why and what's missing: What's Missing & How to Improve:
Example of an Improved Summary: [logs showing the issue before the fix, e.g., SD card initialization failure] [logs showing successful SD card initialization and operation] Remember: Tailor this example to your specific PR, providing accurate and detailed information. |
Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
xiaoxiang781216
approved these changes
Sep 19, 2024
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.
Summary
When attempting to assign a value greater than 1 to a 1-bit bit-field, the result is undefined.
On many systems, this may cause the value to be truncated, keeping only the least significant bit.
In this specific case, the result of scr[0] & 2 is 2 (binary 10), but only the least significant bit (0) will be stored
Impact
mmcsd
Testing
NA