Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1568150 > unrolled thread

[PATCH] Dma - Fix possible NULL derefrence.

Started byShailendra Verma <shailendra.v@samsung.com>
First post2017-01-27 12:30 +0100
Last post2017-01-30 18:00 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] Dma - Fix possible NULL derefrence. Shailendra Verma <shailendra.v@samsung.com> - 2017-01-27 12:30 +0100
    Re: [PATCH] Dma - Fix possible NULL derefrence. Vinod Koul <vinod.koul@intel.com> - 2017-01-30 18:00 +0100

#1568150 — [PATCH] Dma - Fix possible NULL derefrence.

FromShailendra Verma <shailendra.v@samsung.com>
Date2017-01-27 12:30 +0100
Subject[PATCH] Dma - Fix possible NULL derefrence.
Message-ID<t4cT8-3sv-5@gated-at.bofh.it>
of_match_device could return NULL, and so cause a NULL
pointer dereference later.

Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
---
 drivers/dma/mv_xor.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 23f7528..c25b3bb 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -1323,7 +1323,10 @@ static int mv_xor_probe(struct platform_device *pdev)
 		const struct of_device_id *of_id =
 			of_match_device(mv_xor_dt_ids,
 					&pdev->dev);
+		if (!of_id) {
+			dev_err(&pdev->dev, "Error: No device match found\n");
+			return -ENODEV;
+		}
 		xordev->xor_type = (uintptr_t)of_id->data;
 	}
 
-- 
1.7.9.5

[toc] | [next] | [standalone]


#1569894

FromVinod Koul <vinod.koul@intel.com>
Date2017-01-30 18:00 +0100
Message-ID<t5nt9-6kA-29@gated-at.bofh.it>
In reply to#1568150
On Fri, Jan 27, 2017 at 04:55:59PM +0530, Shailendra Verma wrote:
> of_match_device could return NULL, and so cause a NULL
> pointer dereference later.

Why is this tagged Dma - ....

Please look at he git log for the file before coming up with random tags

Worst part, this patch fails to apply, so which was this generated against?

> 
> Signed-off-by: Shailendra Verma <shailendra.v@samsung.com>
> ---
>  drivers/dma/mv_xor.c |    5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
> index 23f7528..c25b3bb 100644
> --- a/drivers/dma/mv_xor.c
> +++ b/drivers/dma/mv_xor.c
> @@ -1323,7 +1323,10 @@ static int mv_xor_probe(struct platform_device *pdev)
>  		const struct of_device_id *of_id =
>  			of_match_device(mv_xor_dt_ids,
>  					&pdev->dev);
> +		if (!of_id) {
> +			dev_err(&pdev->dev, "Error: No device match found\n");
> +			return -ENODEV;
> +		}
>  		xordev->xor_type = (uintptr_t)of_id->data;
>  	}
>  
> -- 
> 1.7.9.5
> 

-- 
~Vinod

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web