cam nvme: fix array overrun
Fix a classic array overrun where the index could be one past the end. Reported by: Coverity CID: 1356596 MFC after: 3 days Sponsored by: Dell EMC
This commit is contained in:
parent
8a114a66b5
commit
2ebb808f8c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=334273
@ -120,7 +120,7 @@ nvme_op_string(const struct nvme_command *cmd)
|
||||
uint8_t opc;
|
||||
|
||||
opc = (cmd->opc_fuse >> NVME_CMD_OPC_SHIFT) & NVME_CMD_OPC_MASK;
|
||||
if (opc > nitems(nvme_opc2str))
|
||||
if (opc >= nitems(nvme_opc2str))
|
||||
return "UNKNOWN";
|
||||
|
||||
return nvme_opc2str[opc];
|
||||
|
Loading…
Reference in New Issue
Block a user