Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 May 2018 03:14:36 +0000 (UTC)
From:      Eric van Gyzen <vangyzen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r334273 - head/sys/cam/nvme
Message-ID:  <201805280314.w4S3EaxA096276@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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];



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201805280314.w4S3EaxA096276>