linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFT PATCH 1/2] ASoC: zx: i2s: Fix devm_ioremap_resource return value check
@ 2015-07-09 13:19 Krzysztof Kozlowski
  2015-07-09 13:19 ` [RFT PATCH 2/2] ASoC: zx: spdif: " Krzysztof Kozlowski
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2015-07-09 13:19 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Jun Nie, alsa-devel, 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>
Cc: <stable@vger.kernel.org>
Fixes: e5d4cd87800c ("ASoC: zx: Add ZTE zx296702 I2S DAI driver")

---

Patch only compile tested.
---
 sound/soc/zte/zx296702-i2s.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/zte/zx296702-i2s.c b/sound/soc/zte/zx296702-i2s.c
index 98d96e1b17e0..1930c42e1f55 100644
--- a/sound/soc/zte/zx296702-i2s.c
+++ b/sound/soc/zte/zx296702-i2s.c
@@ -393,9 +393,9 @@ static int zx_i2s_probe(struct platform_device *pdev)
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	zx_i2s->mapbase = res->start;
 	zx_i2s->reg_base = devm_ioremap_resource(&pdev->dev, res);
-	if (!zx_i2s->reg_base) {
+	if (IS_ERR(zx_i2s->reg_base)) {
 		dev_err(&pdev->dev, "ioremap failed!\n");
-		return -EIO;
+		return PTR_ERR(zx_i2s->reg_base);
 	}
 
 	writel_relaxed(0, zx_i2s->reg_base + ZX_I2S_FIFO_CTRL);
-- 
2.1.4


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

* [RFT PATCH 2/2] ASoC: zx: spdif: Fix devm_ioremap_resource return value check
  2015-07-09 13:19 [RFT PATCH 1/2] ASoC: zx: i2s: Fix devm_ioremap_resource return value check Krzysztof Kozlowski
@ 2015-07-09 13:19 ` Krzysztof Kozlowski
  2015-07-11  2:01   ` Jun Nie
  2015-07-09 15:33 ` [RFT PATCH 1/2] ASoC: zx: i2s: " Mark Brown
  2015-07-11  2:02 ` Jun Nie
  2 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Kozlowski @ 2015-07-09 13:19 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	Jun Nie, alsa-devel, 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>
Cc: <stable@vger.kernel.org>
Fixes: 6fc3d24d4277 ("ASoC: zx: Add zx296702 SPDIF support")

---

Patch only compile tested.
---
 sound/soc/zte/zx296702-spdif.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/zte/zx296702-spdif.c b/sound/soc/zte/zx296702-spdif.c
index 11a0e46a1156..26265ce4caca 100644
--- a/sound/soc/zte/zx296702-spdif.c
+++ b/sound/soc/zte/zx296702-spdif.c
@@ -322,9 +322,9 @@ static int zx_spdif_probe(struct platform_device *pdev)
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	zx_spdif->mapbase = res->start;
 	zx_spdif->reg_base = devm_ioremap_resource(&pdev->dev, res);
-	if (!zx_spdif->reg_base) {
+	if (IS_ERR(zx_spdif->reg_base)) {
 		dev_err(&pdev->dev, "ioremap failed!\n");
-		return -EIO;
+		return PTR_ERR(zx_spdif->reg_base);
 	}
 
 	zx_spdif_dev_init(zx_spdif->reg_base);
-- 
2.1.4


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

* Re: [RFT PATCH 1/2] ASoC: zx: i2s: Fix devm_ioremap_resource return value check
  2015-07-09 13:19 [RFT PATCH 1/2] ASoC: zx: i2s: Fix devm_ioremap_resource return value check Krzysztof Kozlowski
  2015-07-09 13:19 ` [RFT PATCH 2/2] ASoC: zx: spdif: " Krzysztof Kozlowski
@ 2015-07-09 15:33 ` Mark Brown
  2015-07-10  0:45   ` Krzysztof Kozłowski
  2015-07-11  2:02 ` Jun Nie
  2 siblings, 1 reply; 6+ messages in thread
From: Mark Brown @ 2015-07-09 15:33 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Jun Nie,
	alsa-devel, linux-kernel, stable

[-- Attachment #1: Type: text/plain, Size: 248 bytes --]

On Thu, Jul 09, 2015 at 10:19:28PM +0900, Krzysztof Kozlowski wrote:

> Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
> Cc: <stable@vger.kernel.org>

Why are you adding a Cc to stable?  The zx driver was added in the merge
window...

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

* Re: [RFT PATCH 1/2] ASoC: zx: i2s: Fix devm_ioremap_resource return value check
  2015-07-09 15:33 ` [RFT PATCH 1/2] ASoC: zx: i2s: " Mark Brown
@ 2015-07-10  0:45   ` Krzysztof Kozłowski
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozłowski @ 2015-07-10  0:45 UTC (permalink / raw)
  To: Mark Brown
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, Jun Nie,
	alsa-devel, linux-kernel, stable

W dniu 10 lipca 2015 00:33 użytkownik Mark Brown <broonie@kernel.org> napisał:
> On Thu, Jul 09, 2015 at 10:19:28PM +0900, Krzysztof Kozlowski wrote:
>
>> Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
>> Cc: <stable@vger.kernel.org>
>
> Why are you adding a Cc to stable?  The zx driver was added in the merge
> window...

My mistake, I did not check when the commit was merged. Can you strip
the CC from the patch?

Best regards,
Krzysztof

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

* Re: [RFT PATCH 2/2] ASoC: zx: spdif: Fix devm_ioremap_resource return value check
  2015-07-09 13:19 ` [RFT PATCH 2/2] ASoC: zx: spdif: " Krzysztof Kozlowski
@ 2015-07-11  2:01   ` Jun Nie
  0 siblings, 0 replies; 6+ messages in thread
From: Jun Nie @ 2015-07-11  2:01 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	alsa-devel, linux-kernel, stable

2015-07-09 21:19 GMT+08:00 Krzysztof Kozlowski <k.kozlowski.k@gmail.com>:
> 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>
> Cc: <stable@vger.kernel.org>
> Fixes: 6fc3d24d4277 ("ASoC: zx: Add zx296702 SPDIF support")
>
> ---
>
> Patch only compile tested.
> ---
>  sound/soc/zte/zx296702-spdif.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/zte/zx296702-spdif.c b/sound/soc/zte/zx296702-spdif.c
> index 11a0e46a1156..26265ce4caca 100644
> --- a/sound/soc/zte/zx296702-spdif.c
> +++ b/sound/soc/zte/zx296702-spdif.c
> @@ -322,9 +322,9 @@ static int zx_spdif_probe(struct platform_device *pdev)
>         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>         zx_spdif->mapbase = res->start;
>         zx_spdif->reg_base = devm_ioremap_resource(&pdev->dev, res);
> -       if (!zx_spdif->reg_base) {
> +       if (IS_ERR(zx_spdif->reg_base)) {
>                 dev_err(&pdev->dev, "ioremap failed!\n");
> -               return -EIO;
> +               return PTR_ERR(zx_spdif->reg_base);
>         }
>
>         zx_spdif_dev_init(zx_spdif->reg_base);
> --
> 2.1.4
>
Reviewed-by: Jun Nie <jun.nie@linaro.org>

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

* Re: [RFT PATCH 1/2] ASoC: zx: i2s: Fix devm_ioremap_resource return value check
  2015-07-09 13:19 [RFT PATCH 1/2] ASoC: zx: i2s: Fix devm_ioremap_resource return value check Krzysztof Kozlowski
  2015-07-09 13:19 ` [RFT PATCH 2/2] ASoC: zx: spdif: " Krzysztof Kozlowski
  2015-07-09 15:33 ` [RFT PATCH 1/2] ASoC: zx: i2s: " Mark Brown
@ 2015-07-11  2:02 ` Jun Nie
  2 siblings, 0 replies; 6+ messages in thread
From: Jun Nie @ 2015-07-11  2:02 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	alsa-devel, linux-kernel, stable

2015-07-09 21:19 GMT+08:00 Krzysztof Kozlowski <k.kozlowski.k@gmail.com>:
> 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>
> Cc: <stable@vger.kernel.org>
> Fixes: e5d4cd87800c ("ASoC: zx: Add ZTE zx296702 I2S DAI driver")
>
> ---
>
> Patch only compile tested.
> ---
>  sound/soc/zte/zx296702-i2s.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/zte/zx296702-i2s.c b/sound/soc/zte/zx296702-i2s.c
> index 98d96e1b17e0..1930c42e1f55 100644
> --- a/sound/soc/zte/zx296702-i2s.c
> +++ b/sound/soc/zte/zx296702-i2s.c
> @@ -393,9 +393,9 @@ static int zx_i2s_probe(struct platform_device *pdev)
>         res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>         zx_i2s->mapbase = res->start;
>         zx_i2s->reg_base = devm_ioremap_resource(&pdev->dev, res);
> -       if (!zx_i2s->reg_base) {
> +       if (IS_ERR(zx_i2s->reg_base)) {
>                 dev_err(&pdev->dev, "ioremap failed!\n");
> -               return -EIO;
> +               return PTR_ERR(zx_i2s->reg_base);
>         }
>
>         writel_relaxed(0, zx_i2s->reg_base + ZX_I2S_FIFO_CTRL);
> --
> 2.1.4
>
Reviewed-by: Jun Nie <jun.nie@linaro.org>

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

end of thread, other threads:[~2015-07-11  7:18 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 1/2] ASoC: zx: i2s: Fix devm_ioremap_resource return value check Krzysztof Kozlowski
2015-07-09 13:19 ` [RFT PATCH 2/2] ASoC: zx: spdif: " Krzysztof Kozlowski
2015-07-11  2:01   ` Jun Nie
2015-07-09 15:33 ` [RFT PATCH 1/2] ASoC: zx: i2s: " Mark Brown
2015-07-10  0:45   ` Krzysztof Kozłowski
2015-07-11  2:02 ` Jun Nie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).