git: 1b38f851d809 - main - nvmecontrol: Update the test for a valid firmare revision slot

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 15 Mar 2024 15:26:58 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=1b38f851d809950cfe112c705029f40edd0579b3

commit 1b38f851d809950cfe112c705029f40edd0579b3
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-03-15 15:18:47 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-03-15 15:18:47 +0000

    nvmecontrol: Update the test for a valid firmare revision slot
    
    Reported by:    Coverity Scan
    CID:            1539214
    Fixes:          7485926e09a0 nvme: Firmware revisions in the firmware slot info logpage are ASCII strings
---
 sbin/nvmecontrol/firmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sbin/nvmecontrol/firmware.c b/sbin/nvmecontrol/firmware.c
index 9e60bd0cee37..9ce2daf28d65 100644
--- a/sbin/nvmecontrol/firmware.c
+++ b/sbin/nvmecontrol/firmware.c
@@ -104,7 +104,7 @@ slot_has_valid_firmware(int fd, int slot)
 	read_logpage(fd, NVME_LOG_FIRMWARE_SLOT,
 	    NVME_GLOBAL_NAMESPACE_TAG, 0, 0, 0, &fw, sizeof(fw));
 
-	if (fw.revision[slot-1] != 0LLU)
+	if (fw.revision[slot-1][0] != '\0')
 		has_fw = true;
 
 	return (has_fw);