Message ID | 20220920174736.9766-5-asmaa@nvidia.com |
---|---|
State | Accepted |
Commit | de24aceb07d426b6f1c59f33889d6a964770547b |
Headers | show |
Series | i2c: i2c-mlxbf.c: bug fixes and new feature support | expand |
diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c index 8a6a0ccc1c39..1a0fc9640c23 100644 --- a/drivers/i2c/busses/i2c-mlxbf.c +++ b/drivers/i2c/busses/i2c-mlxbf.c @@ -731,6 +731,9 @@ mlxbf_i2c_smbus_start_transaction(struct mlxbf_i2c_priv *priv, if (flags & MLXBF_I2C_F_WRITE) { write_en = 1; write_len += operation->length; + if (data_idx + operation->length > + MLXBF_I2C_MASTER_DATA_DESC_SIZE) + return -ENOBUFS; memcpy(data_desc + data_idx, operation->buffer, operation->length); data_idx += operation->length;