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

feat: stop decoding without error if EOF encountered during header read #17

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

michaelbeaumont
Copy link
Contributor

Linux v6.6.39 stops decoding with EOF in this situation but maintains the already decoded structures. See /drivers/firmware/dmi_scan.c

I included a test with the DMI I'm using.

Fixes #16

Linux v6.6.39 stops decoding with EOF in this situation but maintains
the already decoded structures. See /drivers/firmware/dmi_scan.c

Fixes siderolabs#16

Signed-off-by: Mike Beaumont <mjboamail@gmail.com>
Signed-off-by: Andrey Smirnov <andrey.smirnov@siderolabs.com>
@smira
Copy link
Member

smira commented Aug 23, 2024

I updated the code, brought back removed tests, and made it actually match Linux - to assume table done on any header short read.

@smira
Copy link
Member

smira commented Aug 23, 2024

/m

@talos-bot talos-bot merged commit e781237 into siderolabs:main Aug 23, 2024
14 checks passed
@michaelbeaumont
Copy link
Contributor Author

Ok, yeah I returned an empty header and relied on the existing behavior with zero value Header but probably better indeed to treat both "bad DMI" cases individually.

Thanks!

@smira
Copy link
Member

smira commented Aug 23, 2024

Ok, yeah I returned an empty header and relied on the existing behavior with zero value Header but probably better indeed to treat both "bad DMI" cases individually.

The problem was with io.EOF and io.ErrUnexpectedEOF, as it depends on whether there were 0 bytes or 1,2,3 bytes available.

Thank you for the change!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EOF in next should return the already parsed, valid structures
4 participants