From nobody Wed Dec 15 11:16:42 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 1C9BE18E9C0A; Wed, 15 Dec 2021 11:16:45 +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 4JDXkh1Fwnz4r03; Wed, 15 Dec 2021 11:16:43 +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 171B31ADF9; Wed, 15 Dec 2021 11:16:43 +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 1BFBGgTd081647; Wed, 15 Dec 2021 11:16:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BFBGgxv081646; Wed, 15 Dec 2021 11:16:42 GMT (envelope-from git) Date: Wed, 15 Dec 2021 11:16:42 GMT Message-Id: <202112151116.1BFBGgxv081646@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Andriy Gapon Subject: git: b6a2aba959c8 - main - 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/main X-Git-Reftype: branch X-Git-Commit: b6a2aba959c8b30d740c653c96c01fb90a3073f7 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639567004; 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=mBd7bbx2Vo9CIUQtcqvkBVszHzlA9QxNcWEZMQWoEPs=; b=kXYwHrD2bF1MyiDIQXLi+rqeEi0a5v7p4M8GFpX9u8x20Q5kC3hkVXZ01yptCMmpo9KpjX zKavIB5v8HcGo1EHN307PwnrQLtzUA2SyZpbNHf9M4JyQgjuQfJY2jOD7rtdDp5H+Nct+v /X795A2tpETE4bKfFZeWkj7rTtK1qRDUkPVN3Ndqxe/8G0aI1FKB1PS0AxhLbFff/rzzg4 J05qMbmuRkM0P72LQe2oZSzjSPXmDzZjeRmEkIPSdroZ63zS0x0L/huyJFgt2u2sFUyl/1 fejxHWfdmAPQHXx8lPw2NZr9sQGNK/ISVdfZ+u4olZTwNeVq+CZUBPi/ydpJ0g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639567004; a=rsa-sha256; cv=none; b=lxbU0CLcUbBSX6A/YdkJgla4TVldbiNR1xBT3kCUQ46HgmC8yRsBSzEeqkHhtHYvwex3jm WXlg8DxBD+A+vykB8CPvcyD4F5MiTU9Wo5lXuLkqDwplfKsYQp8BDwd9D/44sFZ+FOdVqD vMJmNmswj42TkB2bdmCXePS0a6c03AR+2kPXuAsG6NvhFGUUwjJO/+sT8mHHLxpEMDNUCn TO/Fm2sa5H43kPq/RSBCLe9EgT5RiN/IUlFIc6UIv9742P1iFz1w7mDRLw2qby9K2AaTeK MjB70G/uTWqiptiOClL20dpV8h2mz1OJgWJz76LNzg1SBwyc1s0rJo1whzb8pA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=b6a2aba959c8b30d740c653c96c01fb90a3073f7 commit b6a2aba959c8b30d740c653c96c01fb90a3073f7 Author: Andriy Gapon AuthorDate: 2021-12-15 08:44:43 +0000 Commit: Andriy Gapon CommitDate: 2021-12-15 11:15:50 +0000 rk_i2c_transfer: fix off-by-one in check for last message This also fixes an access beyond msgs array. MFC after: 1 week --- 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 5ee1b8e96744..55cea8895c43 100644 --- a/sys/arm64/rockchip/rk_i2c.c +++ b/sys/arm64/rockchip/rk_i2c.c @@ -539,7 +539,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);