mirror of
https://git.missingno.dev/kolibrios-nvme-driver/
synced 2024-12-22 05:48:47 +01:00
fix: add null terminator to IDENTC ASCII strings
This prevents garbage and redundant values from being printed to the debug log.
This commit is contained in:
parent
0f140a9c90
commit
c9d58c1ec7
@ -804,14 +804,22 @@ proc nvme_init stdcall, pci:dword
|
||||
mov eax, dword [edi + IDENTC.nn]
|
||||
mov dword [esi + pcidev.nn], eax
|
||||
DEBUGF DBG_INFO, "nvme%u: Namespace Count: %u\n", [esi + pcidev.num], eax
|
||||
|
||||
; Note that the specification only allows ASCII strings that contain code
|
||||
; values between 0x20 (' ') and 0x7E ('~'). Strings are left justified and
|
||||
; padded with spaces (at least according to the 1.4.0 spec) which means there
|
||||
; is no null terminator anywhere. To prevent garbage or repeated values from
|
||||
; being printed to the debug log, I have inserted a 0 byte at the end of each
|
||||
; string.
|
||||
lea ebx, byte [edi + IDENTC.sn]
|
||||
lea eax, byte [esi + pcidev.serial]
|
||||
stdcall memcpyd, eax, ebx, 20 / 4
|
||||
DEBUGF DBG_INFO, "nvme%u: Serial Number: %s\n", [esi + pcidev.num], eax
|
||||
mov byte [ebx + 19], 0
|
||||
DEBUGF DBG_INFO, "nvme%u: Serial Number: %s\n", [esi + pcidev.num], ebx
|
||||
add ebx, 20
|
||||
lea eax, byte [esi + pcidev.model]
|
||||
stdcall memcpyd, eax, ebx, 40 / 4
|
||||
DEBUGF DBG_INFO, "nvme%u: Model: %s\n", [esi + pcidev.num], eax
|
||||
mov byte [ebx + 39], 0
|
||||
DEBUGF DBG_INFO, "nvme%u: Model Number: %s\n", [esi + pcidev.num], ebx
|
||||
add ebx, 40
|
||||
mov byte [ebx + 7], 0
|
||||
DEBUGF DBG_INFO, "nvme%u: Firmware Revision: %s\n", [esi + pcidev.num], ebx
|
||||
mov edx, dword [esi + pcidev.version]
|
||||
|
||||
cmp edx, VS140
|
||||
|
Loading…
Reference in New Issue
Block a user