git: 661e3d4f1548 - stable/13 - nvmecontrol: Update the test for a valid firmare revision slot

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 08 Apr 2024 20:26:00 UTC
The branch stable/13 has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=661e3d4f1548707358c3e1e51eeaf806b0a6f786

commit 661e3d4f1548707358c3e1e51eeaf806b0a6f786
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-03-15 15:18:47 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-04-08 18:01:32 +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
    
    (cherry picked from commit 1b38f851d809950cfe112c705029f40edd0579b3)
---
 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 256847ef8ac2..80bbff032cf2 100644
--- a/sbin/nvmecontrol/firmware.c
+++ b/sbin/nvmecontrol/firmware.c
@@ -105,7 +105,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);