From nobody Wed Dec 22 06:51:28 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 C015618F7A0F; Wed, 22 Dec 2021 06:51:29 +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 4JJkWP0wsSz3LCy; Wed, 22 Dec 2021 06:51:29 +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 C2D2C18B38; Wed, 22 Dec 2021 06:51:28 +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 1BM6pSw6035986; Wed, 22 Dec 2021 06:51:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BM6pShu035985; Wed, 22 Dec 2021 06:51:28 GMT (envelope-from git) Date: Wed, 22 Dec 2021 06:51:28 GMT Message-Id: <202112220651.1BM6pShu035985@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: f8258670cab5 - stable/13 - 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/13 X-Git-Reftype: branch X-Git-Commit: f8258670cab5249d2755686b048adbaff726e833 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1640155889; 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=fIvF8PMmM8XKyMYTjjqtFBF9b5NiNn5kYAHzUeOMSlI=; b=rW9k+nEQz6RBPaqJKcpDwz6AxNlKkz3oQ2yEgJC/V0/ZCNbnH+7xBtTH0uNY2am/akSczG YKLKO2E3npGOexu1NGr8HvyEZrvBiHeqe3FH0pT4tbXxoLeZo1TxCTH3vx9q9xUjdnnqDE Glv7MW/gQNSWMG+Lq20d0SrCbgLjFm73cdJsnnLLREbuZNgae2+7gp2I3+lr84opgo828W ABGhFaeZU/JKVbrYsny/cuxAJR+5na2V4FrKsC2mhNs1+uPdj1VPi4C4lzFkX9nAt6eQ/7 pIpD2q5VD72awqobDQ1EDMe02Ro0y/2KA+uM2gW4B9ktKTlXImjRuI5xQBoabg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1640155889; a=rsa-sha256; cv=none; b=AbQE7MWBvXeTSHgbom2ndIrQnOwGFywWA0eCqfKhYQgb8aaekQKOmxhMXXv7EubP0k5zSk OaEcf5xWwUOiQlIDx6mu+zhHuUoa2yuOQA/39SH2k1Qh/AtlvqFsJiP0zW1mQZkqQ3+K9V m3JlswUdAnPtXk5jb7voXk04kZZbKW2CHNIDV7KX8ywUvIkTmWXdgnmw5XIYCoysb/ec// a2lkF2aQlAucC8AseN6OPLlj+6yycUJcGIaCCggxx113SUCa3WW2TK57Ph6DlJ95yU0Jer 0bftNJgeeNe08uADrV98lzSyP/BVWPmyqxS9GEAr7Z/XDZVZ2oMag2ycGvdopw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=f8258670cab5249d2755686b048adbaff726e833 commit f8258670cab5249d2755686b048adbaff726e833 Author: Andriy Gapon AuthorDate: 2021-12-15 08:44:43 +0000 Commit: Andriy Gapon CommitDate: 2021-12-22 06:49:15 +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 026c731af4d4..71ed2d543069 100644 --- a/sys/arm64/rockchip/rk_i2c.c +++ b/sys/arm64/rockchip/rk_i2c.c @@ -516,7 +516,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);