oxidecomputer / oxidecomputer/propolis
nvme: don't pad strings with zeros
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 270
- Forks
- 42
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 6
Description
In #789 it was noted that we were trying to workaround cases where the virtual NVMe devices are padding the model, serial, and firmware revision entries of the identify controller data structure with the value 0x0 which turns it into a NUL character. This isn't quite correct per the NVMe spec. Instead, these fields are expected to be padded with strings and spaces. This means that the defaults that we're using which zero fill these fields (and any other strings) are incorrect and we should really be filling them with spaces. This is defined in Conventions section (§1.5) of the NVMe specification. While this wasn't explicit in NVMe 1.0 and NVMe 1.1, in NVMe 1.2 it makes it clear with: The string is left justified and shall be padded with spaces (ASCII character 20h) to the right if necessary. It's wroth noting that this is the same convention used in many other places.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the NVMe identify controller data structure and the defaults used for model, serial, firmware revision, and other string fields. Compare the padding behavior with the NVMe specification's Conventions section (§1.5). Done means these fields use space padding rather than NUL characters, with relevant tests or validation passing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100