summaryrefslogtreecommitdiffstats
path: root/drivers/staging/fbtft
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2017-07-18 12:30:10 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-07-28 17:08:16 -0700
commit0d0d4d21a09981e65b2bd386c999e8c0ecc6444e (patch)
treedc459922ebe8cd9bfa55c9bec874453806baa462 /drivers/staging/fbtft
parentc2d79b4b6dcf7b92003b129a3df90f89e878c8c4 (diff)
downloadblackbird-op-linux-0d0d4d21a09981e65b2bd386c999e8c0ecc6444e.tar.gz
blackbird-op-linux-0d0d4d21a09981e65b2bd386c999e8c0ecc6444e.zip
staging: fbtft: array underflow in fbtft_request_gpios_match()
"val" can be negative, so we'd write before the start of the par->gpio.db[] array. Fixes: c296d5f9957c ("staging: fbtft: core support") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/fbtft')
-rw-r--r--drivers/staging/fbtft/fbtft-core.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c
index b742ee786615..6d0363deba61 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -84,7 +84,7 @@ static unsigned long fbtft_request_gpios_match(struct fbtft_par *par,
const struct fbtft_gpio *gpio)
{
int ret;
- long val;
+ unsigned int val;
fbtft_par_dbg(DEBUG_REQUEST_GPIOS_MATCH, par, "%s('%s')\n",
__func__, gpio->name);
@@ -108,7 +108,7 @@ static unsigned long fbtft_request_gpios_match(struct fbtft_par *par,
par->gpio.latch = gpio->gpio;
return GPIOF_OUT_INIT_LOW;
} else if (gpio->name[0] == 'd' && gpio->name[1] == 'b') {
- ret = kstrtol(&gpio->name[2], 10, &val);
+ ret = kstrtouint(&gpio->name[2], 10, &val);
if (ret == 0 && val < 16) {
par->gpio.db[val] = gpio->gpio;
return GPIOF_OUT_INIT_LOW;
OpenPOWER on IntegriCloud