All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [RFT PATCH] gpio: etraxfs: Fix devm_ioremap_resource return value check
@ 2015-07-09 13:19 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2015-07-09 13:19 UTC (permalink / raw
  To: Linus Walleij, Alexandre Courbot, linux-gpio, linux-kernel
  Cc: Krzysztof Kozlowski, stable

Value returned by devm_ioremap_resource() was checked for non-NULL but
devm_ioremap_resource() returns IOMEM_ERR_PTR, not NULL. In case of
error this could lead to dereference of ERR_PTR.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Fixes: d342571efea8 ("gpio: add ETRAXFS GPIO driver")
Cc: <stable@vger.kernel.org>

---

Patch only compile tested.
---
 drivers/gpio/gpio-etraxfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-etraxfs.c b/drivers/gpio/gpio-etraxfs.c
index 28071f4a5672..0e643140efde 100644
--- a/drivers/gpio/gpio-etraxfs.c
+++ b/drivers/gpio/gpio-etraxfs.c
@@ -117,8 +117,8 @@ static int etraxfs_gpio_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	regs = devm_ioremap_resource(dev, res);
-	if (!regs)
-		return -ENOMEM;
+	if (IS_ERR(regs))
+		return PTR_ERR(regs);
 
 	match = of_match_node(etraxfs_gpio_of_table, dev->of_node);
 	if (!match)
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [RFT PATCH] gpio: etraxfs: Fix devm_ioremap_resource return value check
@ 2015-07-09 13:19 ` Krzysztof Kozlowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2015-07-09 13:19 UTC (permalink / raw
  To: Linus Walleij, Alexandre Courbot, linux-gpio, linux-kernel
  Cc: Krzysztof Kozlowski, stable

Value returned by devm_ioremap_resource() was checked for non-NULL but
devm_ioremap_resource() returns IOMEM_ERR_PTR, not NULL. In case of
error this could lead to dereference of ERR_PTR.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Fixes: d342571efea8 ("gpio: add ETRAXFS GPIO driver")
Cc: <stable@vger.kernel.org>

---

Patch only compile tested.
---
 drivers/gpio/gpio-etraxfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-etraxfs.c b/drivers/gpio/gpio-etraxfs.c
index 28071f4a5672..0e643140efde 100644
--- a/drivers/gpio/gpio-etraxfs.c
+++ b/drivers/gpio/gpio-etraxfs.c
@@ -117,8 +117,8 @@ static int etraxfs_gpio_probe(struct platform_device *pdev)
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	regs = devm_ioremap_resource(dev, res);
-	if (!regs)
-		return -ENOMEM;
+	if (IS_ERR(regs))
+		return PTR_ERR(regs);
 
 	match = of_match_node(etraxfs_gpio_of_table, dev->of_node);
 	if (!match)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [RFT PATCH] gpio: etraxfs: Fix devm_ioremap_resource return value check
  2015-07-09 13:19 ` Krzysztof Kozlowski
  (?)
@ 2015-07-13 14:36 ` Alexandre Courbot
  -1 siblings, 0 replies; 6+ messages in thread
From: Alexandre Courbot @ 2015-07-13 14:36 UTC (permalink / raw
  To: Krzysztof Kozlowski
  Cc: Linus Walleij, linux-gpio@vger.kernel.org,
	Linux Kernel Mailing List, Stable

On Thu, Jul 9, 2015 at 10:19 PM, Krzysztof Kozlowski
<k.kozlowski.k@gmail.com> wrote:
> Value returned by devm_ioremap_resource() was checked for non-NULL but
> devm_ioremap_resource() returns IOMEM_ERR_PTR, not NULL. In case of
> error this could lead to dereference of ERR_PTR.

Look obvious enough to be merged without testing.

Acked-by: Alexandre Courbot <acourbot@nvidia.com>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFT PATCH] gpio: etraxfs: Fix devm_ioremap_resource return value check
  2015-07-09 13:19 ` Krzysztof Kozlowski
  (?)
  (?)
@ 2015-07-16 13:52 ` Linus Walleij
  -1 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2015-07-16 13:52 UTC (permalink / raw
  To: Krzysztof Kozlowski, Rabin Vincent
  Cc: Alexandre Courbot, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable

On Thu, Jul 9, 2015 at 3:19 PM, Krzysztof Kozlowski
<k.kozlowski.k@gmail.com> wrote:

> Value returned by devm_ioremap_resource() was checked for non-NULL but
> devm_ioremap_resource() returns IOMEM_ERR_PTR, not NULL. In case of
> error this could lead to dereference of ERR_PTR.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
> Fixes: d342571efea8 ("gpio: add ETRAXFS GPIO driver")
> Cc: <stable@vger.kernel.org>
>
> ---
>
> Patch only compile tested.
> ---
>  drivers/gpio/gpio-etraxfs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpio/gpio-etraxfs.c b/drivers/gpio/gpio-etraxfs.c
> index 28071f4a5672..0e643140efde 100644
> --- a/drivers/gpio/gpio-etraxfs.c
> +++ b/drivers/gpio/gpio-etraxfs.c
> @@ -117,8 +117,8 @@ static int etraxfs_gpio_probe(struct platform_device *pdev)
>
>         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>         regs = devm_ioremap_resource(dev, res);
> -       if (!regs)
> -               return -ENOMEM;
> +       if (IS_ERR(regs))
> +               return PTR_ERR(regs);
>
>         match = of_match_node(etraxfs_gpio_of_table, dev->of_node);
>         if (!match)

Rabin, can you ACK this?

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFT PATCH] gpio: etraxfs: Fix devm_ioremap_resource return value check
  2015-07-09 13:19 ` Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  (?)
@ 2015-07-16 17:36 ` Rabin Vincent
  -1 siblings, 0 replies; 6+ messages in thread
From: Rabin Vincent @ 2015-07-16 17:36 UTC (permalink / raw
  To: Krzysztof Kozlowski
  Cc: Linus Walleij, Alexandre Courbot, linux-gpio, linux-kernel,
	stable

On Thu, Jul 09, 2015 at 10:19:53PM +0900, Krzysztof Kozlowski wrote:
> Value returned by devm_ioremap_resource() was checked for non-NULL but
> devm_ioremap_resource() returns IOMEM_ERR_PTR, not NULL. In case of
> error this could lead to dereference of ERR_PTR.
> 
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
> Fixes: d342571efea8 ("gpio: add ETRAXFS GPIO driver")

Acked-by: Rabin Vincent <rabin@rab.in>

> Cc: <stable@vger.kernel.org>

I don't think this demands a stable backport though.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFT PATCH] gpio: etraxfs: Fix devm_ioremap_resource return value check
  2015-07-09 13:19 ` Krzysztof Kozlowski
                   ` (3 preceding siblings ...)
  (?)
@ 2015-07-17  7:49 ` Linus Walleij
  -1 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2015-07-17  7:49 UTC (permalink / raw
  To: Krzysztof Kozlowski, Rabin Vincent
  Cc: Alexandre Courbot, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable

On Thu, Jul 9, 2015 at 3:19 PM, Krzysztof Kozlowski
<k.kozlowski.k@gmail.com> wrote:

> Value returned by devm_ioremap_resource() was checked for non-NULL but
> devm_ioremap_resource() returns IOMEM_ERR_PTR, not NULL. In case of
> error this could lead to dereference of ERR_PTR.
>
> Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
> Fixes: d342571efea8 ("gpio: add ETRAXFS GPIO driver")
> Cc: <stable@vger.kernel.org>

Patch applied for next cycle, stripped the Fixes: and stable tags.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-07-17  7:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-09 13:19 [RFT PATCH] gpio: etraxfs: Fix devm_ioremap_resource return value check Krzysztof Kozlowski
2015-07-09 13:19 ` Krzysztof Kozlowski
2015-07-13 14:36 ` Alexandre Courbot
2015-07-16 13:52 ` Linus Walleij
2015-07-16 17:36 ` Rabin Vincent
2015-07-17  7:49 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.