Skip to content

Commit

Permalink
mfd: Fix off-by-one value range checking for tps6507x
Browse files Browse the repository at this point in the history
If bytes == (TPS6507X_MAX_REGISTER + 1), we have a buffer overflow when
doing memcpy(&msg[1], src, bytes).

Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Samuel Ortiz <[email protected]>
  • Loading branch information
AxelLin authored and Samuel Ortiz committed Oct 28, 2010
1 parent 7745cc8 commit a8d6aa0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/mfd/tps6507x.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static int tps6507x_i2c_write_device(struct tps6507x_dev *tps6507x, char reg,
u8 msg[TPS6507X_MAX_REGISTER + 1];
int ret;

if (bytes > (TPS6507X_MAX_REGISTER + 1))
if (bytes > TPS6507X_MAX_REGISTER)
return -EINVAL;

msg[0] = reg;
Expand Down

0 comments on commit a8d6aa0

Please sign in to comment.