summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-mockup.c
diff options
context:
space:
mode:
authorBartosz Golaszewski <brgl@bgdev.pl>2017-11-27 11:48:39 +0100
committerLinus Walleij <linus.walleij@linaro.org>2017-12-02 22:42:24 +0100
commitb447a75100a63c114a8aaa02563088f4995c09f3 (patch)
treeb89d507ec4b2d136657b693d7d71cd3ac72f7442 /drivers/gpio/gpio-mockup.c
parentgpio: mockup: parse the module params in init, not probe (diff)
downloadlinux-b447a75100a63c114a8aaa02563088f4995c09f3.tar.xz
linux-b447a75100a63c114a8aaa02563088f4995c09f3.zip
gpio: mockup: verify the number of GPIO chips requested
The number of supported mockup chips is limited. Check this limit when parsing the module parameters. Also: make sure that each chip is described with a <base - ngpio> pair. Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-mockup.c')
-rw-r--r--drivers/gpio/gpio-mockup.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
index b70f3b0c30b1..0a269cbe197c 100644
--- a/drivers/gpio/gpio-mockup.c
+++ b/drivers/gpio/gpio-mockup.c
@@ -330,7 +330,9 @@ static int __init gpio_mockup_init(void)
{
int err;
- if (gpio_mockup_params_nr < 2 || (gpio_mockup_params_nr % 2))
+ if ((gpio_mockup_params_nr < 2) ||
+ (gpio_mockup_params_nr % 2) ||
+ (gpio_mockup_params_nr > GPIO_MOCKUP_MAX_RANGES))
return -EINVAL;
gpio_mockup_dbg_dir = debugfs_create_dir("gpio-mockup-event", NULL);