diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c index b70f3b0c30b1d9e42a8017dbb16fb30223eee91b..0a269cbe197cfd7085e4bedcc62dc5c145d31c8a 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);