From nobody Wed Dec 22 06:59:18 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id F240318FA802; Wed, 22 Dec 2021 06:59:20 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4JJkhR6Lq0z3PPc; Wed, 22 Dec 2021 06:59:19 +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 09AF218DB6; Wed, 22 Dec 2021 06:59:19 +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 1BM6xI6N036887; Wed, 22 Dec 2021 06:59:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BM6xInj036886; Wed, 22 Dec 2021 06:59:18 GMT (envelope-from git) Date: Wed, 22 Dec 2021 06:59:18 GMT Message-Id: <202112220659.1BM6xInj036886@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Andriy Gapon Subject: git: 94859be65dc2 - stable/12 - rk_i2c_transfer: fix off-by-one in check for last message List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: avg X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 94859be65dc2e9633eea10fc3f64c01cdfa182c9 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640156360; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=i8b6311KVX8heDm/UL8j5HrSvpfVL4PN0fEVOB+3RUs=; b=TP5NeGLI2UM3gZK/HgVjOQ9mTz6wjbrapkkKb1FHP91UeFmvOOtfIcrF3j6B5yrJe0dH/g +J2HmzYczC98hvFxpIYDTB2UXuk+FMGPGpq/kOUxybzyAqJF0rD0LQoIqJd4hsXTCk+5sF nuHhpXLuyV+nNnzVxJoLAy7K+ISQtpFvw6W1CBP0OT9PTsf5WJX9pn2PaO1v/TJJIThRGs E730v0h8KP4hyKWeMllu0UCNI9yx/ZLEhzq2qwRESvQuyxXoD2AWF1OmipuUs3CBwnaRLL NxOpdfFcLYLlfEKlpkjRFw9cRPuGoOu/P+dnxFS4ivOPhK5JrbkzjQ3VCZC89A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640156360; a=rsa-sha256; cv=none; b=WmSjifwWVIAn/cLFbYMCZkY281WGGdWJn2z2l2V5lAQRQMc6WlQFiWVgTh/xFOnkD7ZN/9 2DLQsChYqFlI6ZeuM+9+rjnoG/RX/gi++VVWOBZdiuXJU9zpYKV5k1ICTJvCDys7aIyPd2 8YUsOZ0Yj4zuwyobOMF6Um+KMTBRwnUOCdxNtnuRdP4Wg31keTmYvcpMPC7GQU/G84sV/8 4yk9n9BOw0QOIvT1PqNh5W7/jRjji4VKeQewsDIq4A96dW9t/mSojlL+J9bomJCfsEMpgt 9AeZsL29x+LLDoTmeIO10tm7o/vR393u2RZQGwkWyDVWrfo1qiQG20KRxmT9bA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/12 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=94859be65dc2e9633eea10fc3f64c01cdfa182c9 commit 94859be65dc2e9633eea10fc3f64c01cdfa182c9 Author: Andriy Gapon AuthorDate: 2021-12-15 08:44:43 +0000 Commit: Andriy Gapon CommitDate: 2021-12-22 06:57:11 +0000 rk_i2c_transfer: fix off-by-one in check for last message This also fixes an access beyond msgs array. (cherry picked from commit b6a2aba959c8b30d740c653c96c01fb90a3073f7) --- sys/arm64/rockchip/rk_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/arm64/rockchip/rk_i2c.c b/sys/arm64/rockchip/rk_i2c.c index 35f7cd8a66e5..13fd5cebaf2d 100644 --- a/sys/arm64/rockchip/rk_i2c.c +++ b/sys/arm64/rockchip/rk_i2c.c @@ -518,7 +518,7 @@ rk_i2c_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) } } /* last message ? */ - last_msg = (i > nmsgs - 1) || + last_msg = (i >= nmsgs - 1) || !(msgs[i + 1].flags & IIC_M_NOSTART); rk_i2c_start_xfer(sc, msgs + i, last_msg);