mfd: Fix off-by-one value range checking for tps6507x
If bytes == (TPS6507X_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>
diff --git a/drivers/mfd/tps6507x.c b/drivers/mfd/tps6507x.c
index fc01976..33ba772 100644
--- a/drivers/mfd/tps6507x.c
+++ b/drivers/mfd/tps6507x.c
@@ -68,7 +68,7 @@
u8 msg[TPS6507X_MAX_REGISTER + 1];
int ret;
- if (bytes > (TPS6507X_MAX_REGISTER + 1))
+ if (bytes > TPS6507X_MAX_REGISTER)
return -EINVAL;
msg[0] = reg;