From owner-dev-commits-src-branches@freebsd.org Mon Jan 11 14:54:03 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6CB54DBCCC; Mon, 11 Jan 2021 14:54:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DDxYQ0D3tz3nnN; Mon, 11 Jan 2021 14:54:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D80711C7BB; Mon, 11 Jan 2021 14:54:01 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 10BEs1Ke073756; Mon, 11 Jan 2021 14:54:01 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 10BEs121073755; Mon, 11 Jan 2021 14:54:01 GMT (envelope-from git) Date: Mon, 11 Jan 2021 14:54:01 GMT Message-Id: <202101111454.10BEs121073755@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: ee01a1e7d862 - stable/12 - mpr, mps: Fix an off-by-one bug in the BTDH_MAPPING ioctl MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: ee01a1e7d862a5a33b43b8ae9da220d83f089c21 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jan 2021 14:54:05 -0000 The branch stable/12 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=ee01a1e7d862a5a33b43b8ae9da220d83f089c21 commit ee01a1e7d862a5a33b43b8ae9da220d83f089c21 Author: Mark Johnston AuthorDate: 2021-01-08 18:32:05 +0000 Commit: Mark Johnston CommitDate: 2021-01-11 14:43:17 +0000 mpr, mps: Fix an off-by-one bug in the BTDH_MAPPING ioctl The device mapping table contains sc->max_devices entries, so only indices in [0, sc->max_devices) are valid. Differential Revision: https://reviews.freebsd.org/D27964 (cherry picked from commit adc0dcc352bb9f5a67a054d95c6959ea5aa26d91) --- sys/dev/mpr/mpr_user.c | 2 +- sys/dev/mps/mps_user.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/mpr/mpr_user.c b/sys/dev/mpr/mpr_user.c index 9bcc7f78da0f..1b2aa398b22b 100644 --- a/sys/dev/mpr/mpr_user.c +++ b/sys/dev/mpr/mpr_user.c @@ -2232,7 +2232,7 @@ mpr_user_btdh(struct mpr_softc *sc, mpr_btdh_mapping_t *data) if (bus != 0) return (EINVAL); - if (target > sc->max_devices) { + if (target >= sc->max_devices) { mpr_dprint(sc, MPR_XINFO, "Target ID is out of range " "for Bus/Target to DevHandle mapping."); return (EINVAL); diff --git a/sys/dev/mps/mps_user.c b/sys/dev/mps/mps_user.c index 15ae463a1ad1..af1526c36d4c 100644 --- a/sys/dev/mps/mps_user.c +++ b/sys/dev/mps/mps_user.c @@ -2135,7 +2135,7 @@ mps_user_btdh(struct mps_softc *sc, mps_btdh_mapping_t *data) if (bus != 0) return (EINVAL); - if (target > sc->max_devices) { + if (target >= sc->max_devices) { mps_dprint(sc, MPS_FAULT, "Target ID is out of range " "for Bus/Target to DevHandle mapping."); return (EINVAL);