diff options
author | Felix Fietkau <nbd@openwrt.org> | 2010-06-26 20:42:58 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2010-06-26 20:42:58 +0000 |
commit | da1bb88a2b900f0392b731ec47c5e1bff956fd8f (patch) | |
tree | 597146471e3eeafb4ba55e802e80b896770808ff /target/linux/generic/patches-2.6.25/964-backport_gpiolib_fix_off_by_one_errors.patch | |
parent | 6117c04c9416b295347fb45c37e430f01df1d0d9 (diff) | |
download | mtk-20170518-da1bb88a2b900f0392b731ec47c5e1bff956fd8f.zip mtk-20170518-da1bb88a2b900f0392b731ec47c5e1bff956fd8f.tar.gz mtk-20170518-da1bb88a2b900f0392b731ec47c5e1bff956fd8f.tar.bz2 |
rename target/linux/generic-2.6 to generic
SVN-Revision: 21952
Diffstat (limited to 'target/linux/generic/patches-2.6.25/964-backport_gpiolib_fix_off_by_one_errors.patch')
-rw-r--r-- | target/linux/generic/patches-2.6.25/964-backport_gpiolib_fix_off_by_one_errors.patch | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/target/linux/generic/patches-2.6.25/964-backport_gpiolib_fix_off_by_one_errors.patch b/target/linux/generic/patches-2.6.25/964-backport_gpiolib_fix_off_by_one_errors.patch new file mode 100644 index 0000000..c875a0d --- /dev/null +++ b/target/linux/generic/patches-2.6.25/964-backport_gpiolib_fix_off_by_one_errors.patch @@ -0,0 +1,46 @@ +From: Trent Piepho <xyzzy@speakeasy.org> +Date: Fri, 23 May 2008 20:04:44 +0000 (-0700) +Subject: gpiolib: fix off by one errors +X-Git-Tag: v2.6.26-rc4~31 +X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=bff5fda972dc23bd1806a47c2098ae173585d013 + +gpiolib: fix off by one errors + +The last gpio belonging to a chip is chip->base + chip->ngpios - 1. Some +places in the code, but not all, forgot the critical minus one. + +Signed-off-by: Trent Piepho <xyzzy@speakeasy.org> +Acked-by: David Brownell <dbrownell@users.sourceforge.net> +Signed-off-by: Andrew Morton <akpm@linux-foundation.org> +Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> +--- + +--- a/drivers/gpio/gpiolib.c ++++ b/drivers/gpio/gpiolib.c +@@ -127,7 +127,7 @@ int __init gpiochip_reserve(int start, i + unsigned long flags; + int i; + +- if (!gpio_is_valid(start) || !gpio_is_valid(start + ngpio)) ++ if (!gpio_is_valid(start) || !gpio_is_valid(start + ngpio - 1)) + return -EINVAL; + + spin_lock_irqsave(&gpio_lock, flags); +@@ -170,7 +170,7 @@ int gpiochip_add(struct gpio_chip *chip) + unsigned id; + int base = chip->base; + +- if ((!gpio_is_valid(base) || !gpio_is_valid(base + chip->ngpio)) ++ if ((!gpio_is_valid(base) || !gpio_is_valid(base + chip->ngpio - 1)) + && base >= 0) { + status = -EINVAL; + goto fail; +@@ -207,7 +207,7 @@ fail: + /* failures here can mean systems won't boot... */ + if (status) + pr_err("gpiochip_add: gpios %d..%d (%s) not registered\n", +- chip->base, chip->base + chip->ngpio, ++ chip->base, chip->base + chip->ngpio - 1, + chip->label ? : "generic"); + return status; + } |