Author: vangyzen
Date: Mon May 28 03:14:36 2018
New Revision: 334273
URL: https://svnweb.freebsd.org/changeset/base/334273

Log:
  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

Modified:
  head/sys/cam/nvme/nvme_all.c

Modified: head/sys/cam/nvme/nvme_all.c
==============================================================================
--- head/sys/cam/nvme/nvme_all.c        Mon May 28 03:09:09 2018        
(r334272)
+++ head/sys/cam/nvme/nvme_all.c        Mon May 28 03:14:36 2018        
(r334273)
@@ -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];
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to