Message ID | 20221003084346.4652-2-harshit.m.mogalapalli@oracle.com |
---|---|
State | New |
Headers | show |
Series | Fix NULL dereference in i2cdev_ioctl_rdwr() | expand |
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c index b7f9fb00f695..08aff5ebc99a 100644 --- a/drivers/i2c/i2c-dev.c +++ b/drivers/i2c/i2c-dev.c @@ -297,7 +297,7 @@ static noinline int i2cdev_ioctl_rdwr(struct i2c_client *client, */ if (rdwr_pa[i].flags & I2C_M_RECV_LEN) { if (!(rdwr_pa[i].flags & I2C_M_RD) || - rdwr_pa[i].buf[0] < 1 || + rdwr_pa[i].len < 1 || rdwr_pa[i].buf[0] < 1 || rdwr_pa[i].len < rdwr_pa[i].buf[0] + I2C_SMBUS_BLOCK_MAX) { i++;