lkml.org 
[lkml]   [2017]   [Nov]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 03/18] gpio: mockup: verify the number of GPIO chips requested
Date
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>
---
drivers/gpio/gpio-mockup.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

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);
--
2.15.0
\
 
 \ /
  Last update: 2017-11-27 12:01    [W:0.083 / U:2.624 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site