nvme: don't pad strings with zeros
Opened this issue · 0 comments
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.