From owner-svn-src-head@freebsd.org Mon May 28 03:14:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72F3CEF6181; Mon, 28 May 2018 03:14:37 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 14C2B7912E; Mon, 28 May 2018 03:14:37 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EA06927798; Mon, 28 May 2018 03:14:36 +0000 (UTC) (envelope-from vangyzen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w4S3Ea2t096277; Mon, 28 May 2018 03:14:36 GMT (envelope-from vangyzen@FreeBSD.org) Received: (from vangyzen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w4S3EaxA096276; Mon, 28 May 2018 03:14:36 GMT (envelope-from vangyzen@FreeBSD.org) Message-Id: <201805280314.w4S3EaxA096276@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vangyzen set sender to vangyzen@FreeBSD.org using -f From: Eric van Gyzen Date: Mon, 28 May 2018 03:14:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r334273 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: vangyzen X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 334273 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 May 2018 03:14:37 -0000 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];