summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/i2c-dev.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2019-01-11 12:28:01 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2019-01-11 12:28:01 -0800
commit4b3c31c8d4dda4d70f3f24a165f3be99499e0328 (patch)
tree16b7bcde559df25651c033a1824e9c75d1c5f891 /drivers/i2c/i2c-dev.c
parentc3405d689974555532c12a4f3a5e72dedc660c0b (diff)
parentb67d4530cdade7ebfafa2c6b46f2a0dad3e41bcb (diff)
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang: "I2C has one core and one driver bugfix for you" * 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: i2c: tegra: Fix Maximum transfer size i2c: dev: prevent adapter retries and timeout being set as minus value
Diffstat (limited to 'drivers/i2c/i2c-dev.c')
-rw-r--r--drivers/i2c/i2c-dev.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index 1aca742fde4a..ccd76c71af09 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -470,9 +470,15 @@ static long i2cdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
data_arg.data);
}
case I2C_RETRIES:
+ if (arg > INT_MAX)
+ return -EINVAL;
+
client->adapter->retries = arg;
break;
case I2C_TIMEOUT:
+ if (arg > INT_MAX)
+ return -EINVAL;
+
/* For historical reasons, user-space sets the timeout
* value in units of 10 ms.
*/