Fix SMBIOS parsing on big-endian architecture#56
Merged
jcreekmore merged 1 commit intojcreekmore:masterfrom Mar 25, 2026
Merged
Fix SMBIOS parsing on big-endian architecture#56jcreekmore merged 1 commit intojcreekmore:masterfrom
jcreekmore merged 1 commit intojcreekmore:masterfrom
Conversation
jcreekmore
requested changes
Mar 24, 2026
Owner
jcreekmore
left a comment
There was a problem hiding this comment.
This looks fine, but is failing the format checks. Also, I found another issue with the tests related to #55, so I fixed that up in master. If you can fix the formatting and rebase on top of master, I will merge and cut a patch release.
SMBIOS defines all multi-byte fields as little-endian, but the packed struct deserialization used ptr::read which reads in native byte order. Apply from_le() to all u16/u32/u64 fields read from packed structs and via the read_bytes helper
12c06cb to
fb3147c
Compare
jcreekmore
approved these changes
Mar 25, 2026
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.
I'm maintaining this crate in Debian. The test suite currently fails there on s390x because the packed struct deserialisation uses
ptr::read, which reads multi-byte fields in native byte order, but SMBIOS defines all fields as little-endian.I know s390x is an unusual target for an SMBIOS library. However, I've noticed that the codebase already uses
from_le_bytesvia theTryFromBytestrait inRawStructure::get(), showing the intent was always to parse SMBIOS fields as little-endian. The packed struct path is simply an oversight that went unnoticed because the test suite only runs on x86.The fix applies from_le() to all u16/u32/u64 fields read from packed structs