All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereferenced
@ 2020-01-09 13:19 ` Colin King
  0 siblings, 0 replies; 10+ messages in thread
From: Colin King @ 2020-01-09 13:19 UTC (permalink / raw)
  To: Vinod Koul, Dan Williams, Peter Ujfalusi, Tony Lindgren, dmaengine
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently when the call to dev_get_platdata returns null the driver issues
a warning and then later dereferences the null pointer.  Avoid this issue
by returning -ENODEV errror rather when the platform data is null and
change the warning to an appropriate error message.

Addresses-Coverity: ("Dereference after null check")
Fixes: 211010aeb097 ("dmaengine: ti: omap-dma: Pass sdma auxdata to driver and use it")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---

V2: return -ENODEV and change warning to an error message as suggested by
    Peter Ujfalusi.
---
 drivers/dma/ti/omap-dma.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c
index fc8f7b2fc7b3..a93515015dce 100644
--- a/drivers/dma/ti/omap-dma.c
+++ b/drivers/dma/ti/omap-dma.c
@@ -1658,8 +1658,10 @@ static int omap_dma_probe(struct platform_device *pdev)
 	if (conf) {
 		od->cfg = conf;
 		od->plat = dev_get_platdata(&pdev->dev);
-		if (!od->plat)
-			dev_warn(&pdev->dev, "no sdma auxdata needed?\n");
+		if (!od->plat) {
+			dev_err(&pdev->dev, "omap_system_dma_plat_info is missing");
+			return -ENODEV;
+		}
 	} else {
 		od->cfg = &default_cfg;
 
-- 
2.24.0


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

* [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereferenced
@ 2020-01-09 13:19 ` Colin King
  0 siblings, 0 replies; 10+ messages in thread
From: Colin King @ 2020-01-09 13:19 UTC (permalink / raw)
  To: Vinod Koul, Dan Williams, Peter Ujfalusi, Tony Lindgren, dmaengine
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Currently when the call to dev_get_platdata returns null the driver issues
a warning and then later dereferences the null pointer.  Avoid this issue
by returning -ENODEV errror rather when the platform data is null and
change the warning to an appropriate error message.

Addresses-Coverity: ("Dereference after null check")
Fixes: 211010aeb097 ("dmaengine: ti: omap-dma: Pass sdma auxdata to driver and use it")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---

V2: return -ENODEV and change warning to an error message as suggested by
    Peter Ujfalusi.
---
 drivers/dma/ti/omap-dma.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c
index fc8f7b2fc7b3..a93515015dce 100644
--- a/drivers/dma/ti/omap-dma.c
+++ b/drivers/dma/ti/omap-dma.c
@@ -1658,8 +1658,10 @@ static int omap_dma_probe(struct platform_device *pdev)
 	if (conf) {
 		od->cfg = conf;
 		od->plat = dev_get_platdata(&pdev->dev);
-		if (!od->plat)
-			dev_warn(&pdev->dev, "no sdma auxdata needed?\n");
+		if (!od->plat) {
+			dev_err(&pdev->dev, "omap_system_dma_plat_info is missing");
+			return -ENODEV;
+		}
 	} else {
 		od->cfg = &default_cfg;
 
-- 
2.24.0

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

* Re: [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereferenced
  2020-01-09 13:19 ` Colin King
@ 2020-01-09 15:33   ` Peter Ujfalusi
  -1 siblings, 0 replies; 10+ messages in thread
From: Peter Ujfalusi @ 2020-01-09 15:33 UTC (permalink / raw)
  To: Colin King, Vinod Koul, Dan Williams, Tony Lindgren, dmaengine
  Cc: kernel-janitors, linux-kernel

Colin,

On 09/01/2020 15.19, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently when the call to dev_get_platdata returns null the driver issues
> a warning and then later dereferences the null pointer.  Avoid this issue
> by returning -ENODEV errror rather when the platform data is null and
> change the warning to an appropriate error message.

Thank you for the update!

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> Addresses-Coverity: ("Dereference after null check")
> Fixes: 211010aeb097 ("dmaengine: ti: omap-dma: Pass sdma auxdata to driver and use it")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> 
> V2: return -ENODEV and change warning to an error message as suggested by
>     Peter Ujfalusi.
> ---
>  drivers/dma/ti/omap-dma.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c
> index fc8f7b2fc7b3..a93515015dce 100644
> --- a/drivers/dma/ti/omap-dma.c
> +++ b/drivers/dma/ti/omap-dma.c
> @@ -1658,8 +1658,10 @@ static int omap_dma_probe(struct platform_device *pdev)
>  	if (conf) {
>  		od->cfg = conf;
>  		od->plat = dev_get_platdata(&pdev->dev);
> -		if (!od->plat)
> -			dev_warn(&pdev->dev, "no sdma auxdata needed?\n");
> +		if (!od->plat) {
> +			dev_err(&pdev->dev, "omap_system_dma_plat_info is missing");
> +			return -ENODEV;
> +		}
>  	} else {
>  		od->cfg = &default_cfg;
>  
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereference
@ 2020-01-09 15:33   ` Peter Ujfalusi
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Ujfalusi @ 2020-01-09 15:33 UTC (permalink / raw)
  To: Colin King, Vinod Koul, Dan Williams, Tony Lindgren, dmaengine
  Cc: kernel-janitors, linux-kernel

Colin,

On 09/01/2020 15.19, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently when the call to dev_get_platdata returns null the driver issues
> a warning and then later dereferences the null pointer.  Avoid this issue
> by returning -ENODEV errror rather when the platform data is null and
> change the warning to an appropriate error message.

Thank you for the update!

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

> Addresses-Coverity: ("Dereference after null check")
> Fixes: 211010aeb097 ("dmaengine: ti: omap-dma: Pass sdma auxdata to driver and use it")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> 
> V2: return -ENODEV and change warning to an error message as suggested by
>     Peter Ujfalusi.
> ---
>  drivers/dma/ti/omap-dma.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/dma/ti/omap-dma.c b/drivers/dma/ti/omap-dma.c
> index fc8f7b2fc7b3..a93515015dce 100644
> --- a/drivers/dma/ti/omap-dma.c
> +++ b/drivers/dma/ti/omap-dma.c
> @@ -1658,8 +1658,10 @@ static int omap_dma_probe(struct platform_device *pdev)
>  	if (conf) {
>  		od->cfg = conf;
>  		od->plat = dev_get_platdata(&pdev->dev);
> -		if (!od->plat)
> -			dev_warn(&pdev->dev, "no sdma auxdata needed?\n");
> +		if (!od->plat) {
> +			dev_err(&pdev->dev, "omap_system_dma_plat_info is missing");
> +			return -ENODEV;
> +		}
>  	} else {
>  		od->cfg = &default_cfg;
>  
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

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

* Re: [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereferenced
  2020-01-09 13:19 ` Colin King
@ 2020-01-10  7:58   ` Vinod Koul
  -1 siblings, 0 replies; 10+ messages in thread
From: Vinod Koul @ 2020-01-10  7:46 UTC (permalink / raw)
  To: Colin King
  Cc: Dan Williams, Peter Ujfalusi, Tony Lindgren, dmaengine,
	kernel-janitors, linux-kernel

On 09-01-20, 13:19, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently when the call to dev_get_platdata returns null the driver issues
> a warning and then later dereferences the null pointer.  Avoid this issue
> by returning -ENODEV errror rather when the platform data is null and

s/errror/error :) never thought would correct Colin on spelling :)

With the typo fixes:

Acked-by: Vinod Koul <vkoul@kernel.org>

-- 
~Vinod

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

* Re: [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereference
@ 2020-01-10  7:58   ` Vinod Koul
  0 siblings, 0 replies; 10+ messages in thread
From: Vinod Koul @ 2020-01-10  7:58 UTC (permalink / raw)
  To: Colin King
  Cc: Dan Williams, Peter Ujfalusi, Tony Lindgren, dmaengine,
	kernel-janitors, linux-kernel

On 09-01-20, 13:19, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
> 
> Currently when the call to dev_get_platdata returns null the driver issues
> a warning and then later dereferences the null pointer.  Avoid this issue
> by returning -ENODEV errror rather when the platform data is null and

s/errror/error :) never thought would correct Colin on spelling :)

With the typo fixes:

Acked-by: Vinod Koul <vkoul@kernel.org>

-- 
~Vinod

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

* Re: [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereferenced
  2020-01-10  7:58   ` [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereference Vinod Koul
@ 2020-01-10  9:21     ` Colin Ian King
  -1 siblings, 0 replies; 10+ messages in thread
From: Colin Ian King @ 2020-01-10  9:21 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Dan Williams, Peter Ujfalusi, Tony Lindgren, dmaengine,
	kernel-janitors, linux-kernel

On 10/01/2020 07:46, Vinod Koul wrote:
> On 09-01-20, 13:19, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> Currently when the call to dev_get_platdata returns null the driver issues
>> a warning and then later dereferences the null pointer.  Avoid this issue
>> by returning -ENODEV errror rather when the platform data is null and
> 
> s/errror/error :) never thought would correct Colin on spelling :)

Doh, I need to add that to the checkpatch dictionary ;-)

If this can be fixed up before it's applied then this would be
appreciated rather than me sending a V3.

> 
> With the typo fixes:
> 
> Acked-by: Vinod Koul <vkoul@kernel.org>
> 


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

* Re: [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereference
@ 2020-01-10  9:21     ` Colin Ian King
  0 siblings, 0 replies; 10+ messages in thread
From: Colin Ian King @ 2020-01-10  9:21 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Dan Williams, Peter Ujfalusi, Tony Lindgren, dmaengine,
	kernel-janitors, linux-kernel

On 10/01/2020 07:46, Vinod Koul wrote:
> On 09-01-20, 13:19, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> Currently when the call to dev_get_platdata returns null the driver issues
>> a warning and then later dereferences the null pointer.  Avoid this issue
>> by returning -ENODEV errror rather when the platform data is null and
> 
> s/errror/error :) never thought would correct Colin on spelling :)

Doh, I need to add that to the checkpatch dictionary ;-)

If this can be fixed up before it's applied then this would be
appreciated rather than me sending a V3.

> 
> With the typo fixes:
> 
> Acked-by: Vinod Koul <vkoul@kernel.org>
> 

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

* Re: [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereferenced
  2020-01-10  9:21     ` [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereference Colin Ian King
@ 2020-01-13 17:46       ` Tony Lindgren
  -1 siblings, 0 replies; 10+ messages in thread
From: Tony Lindgren @ 2020-01-13 17:46 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Vinod Koul, Dan Williams, Peter Ujfalusi, dmaengine,
	kernel-janitors, linux-kernel

* Colin Ian King <colin.king@canonical.com> [200110 09:22]:
> On 10/01/2020 07:46, Vinod Koul wrote:
> > On 09-01-20, 13:19, Colin King wrote:
> >> From: Colin Ian King <colin.king@canonical.com>
> >>
> >> Currently when the call to dev_get_platdata returns null the driver issues
> >> a warning and then later dereferences the null pointer.  Avoid this issue
> >> by returning -ENODEV errror rather when the platform data is null and
> > 
> > s/errror/error :) never thought would correct Colin on spelling :)
> 
> Doh, I need to add that to the checkpatch dictionary ;-)
> 
> If this can be fixed up before it's applied then this would be
> appreciated rather than me sending a V3.

I've fixed i up and pushed out into omap-for-v5.6/sdma.

Thanks,

Tony

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

* Re: [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereference
@ 2020-01-13 17:46       ` Tony Lindgren
  0 siblings, 0 replies; 10+ messages in thread
From: Tony Lindgren @ 2020-01-13 17:46 UTC (permalink / raw)
  To: Colin Ian King
  Cc: Vinod Koul, Dan Williams, Peter Ujfalusi, dmaengine,
	kernel-janitors, linux-kernel

* Colin Ian King <colin.king@canonical.com> [200110 09:22]:
> On 10/01/2020 07:46, Vinod Koul wrote:
> > On 09-01-20, 13:19, Colin King wrote:
> >> From: Colin Ian King <colin.king@canonical.com>
> >>
> >> Currently when the call to dev_get_platdata returns null the driver issues
> >> a warning and then later dereferences the null pointer.  Avoid this issue
> >> by returning -ENODEV errror rather when the platform data is null and
> > 
> > s/errror/error :) never thought would correct Colin on spelling :)
> 
> Doh, I need to add that to the checkpatch dictionary ;-)
> 
> If this can be fixed up before it's applied then this would be
> appreciated rather than me sending a V3.

I've fixed i up and pushed out into omap-for-v5.6/sdma.

Thanks,

Tony

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

end of thread, other threads:[~2020-01-13 17:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-09 13:19 [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereferenced Colin King
2020-01-09 13:19 ` Colin King
2020-01-09 15:33 ` Peter Ujfalusi
2020-01-09 15:33   ` [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereference Peter Ujfalusi
2020-01-10  7:46 ` [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereferenced Vinod Koul
2020-01-10  7:58   ` [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereference Vinod Koul
2020-01-10  9:21   ` [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereferenced Colin Ian King
2020-01-10  9:21     ` [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereference Colin Ian King
2020-01-13 17:46     ` [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereferenced Tony Lindgren
2020-01-13 17:46       ` [PATCH][next][V2] dmaengine: ti: omap-dma: don't allow a null od->plat pointer to be dereference Tony Lindgren

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.