diff options
| author | Axel Lin <axel.lin@gmail.com> | 2011-06-24 03:34:16 -0400 |
|---|---|---|
| committer | Samuel Ortiz <sameo@linux.intel.com> | 2011-07-31 17:28:25 -0400 |
| commit | 63c8a58d226a0701272b54015a8d73643d72cd3d (patch) | |
| tree | 016d6f2ca080a9cd694a8b41ddca96273d8c4ac3 | |
| parent | a5e06781f073842beb81d088eb787f0ea23d6499 (diff) | |
mfd: Fix off-by-one value range checking for tps65912_i2c_write
If bytes == (TPS6591X_MAX_REGISTER + 1), we have a buffer overflow when
doing memcpy(&msg[1], src, bytes).
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
| -rw-r--r-- | drivers/mfd/tps65912-i2c.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mfd/tps65912-i2c.c b/drivers/mfd/tps65912-i2c.c index 9ed123aa6624..c041f2c3d2bd 100644 --- a/drivers/mfd/tps65912-i2c.c +++ b/drivers/mfd/tps65912-i2c.c | |||
| @@ -57,7 +57,7 @@ static int tps65912_i2c_write(struct tps65912 *tps65912, u8 reg, | |||
| 57 | u8 msg[TPS6591X_MAX_REGISTER + 1]; | 57 | u8 msg[TPS6591X_MAX_REGISTER + 1]; |
| 58 | int ret; | 58 | int ret; |
| 59 | 59 | ||
| 60 | if (bytes > (TPS6591X_MAX_REGISTER + 1)) | 60 | if (bytes > TPS6591X_MAX_REGISTER) |
| 61 | return -EINVAL; | 61 | return -EINVAL; |
| 62 | 62 | ||
| 63 | msg[0] = reg; | 63 | msg[0] = reg; |
