git: f8258670cab5 - stable/13 - rk_i2c_transfer: fix off-by-one in check for last message
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 22 Dec 2021 06:51:28 UTC
The branch stable/13 has been updated by avg: URL: https://cgit.FreeBSD.org/src/commit/?id=f8258670cab5249d2755686b048adbaff726e833 commit f8258670cab5249d2755686b048adbaff726e833 Author: Andriy Gapon <avg@FreeBSD.org> AuthorDate: 2021-12-15 08:44:43 +0000 Commit: Andriy Gapon <avg@FreeBSD.org> 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);