linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] dmaengine: Use Pointer xt after NULL check.
@ 2015-06-26 10:34 Maninder Singh
  2015-06-26 12:24 ` Nicolas Ferre
  2015-07-07  4:22 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Maninder Singh @ 2015-06-26 10:34 UTC (permalink / raw)
  To: linux-arm-kernel

Removing static analysis error:-
Possible null pointer dereference: xt

Because currently xt is dereferenced before NULL check,
Thus Use it after NULL Check.

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Reviewed-by: Vaneet Narang <v.narang@samsung.com>
---
 drivers/dma/at_hdmac.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 59892126..d313acb 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -659,14 +659,14 @@ atc_prep_dma_interleaved(struct dma_chan *chan,
 	size_t			len = 0;
 	int			i;
 
+	if (unlikely(!xt || xt->numf != 1 || !xt->frame_size))
+		return NULL;
+
 	dev_info(chan2dev(chan),
 		 "%s: src=0x%08x, dest=0x%08x, numf=%d, frame_size=%d, flags=0x%lx\n",
 		__func__, xt->src_start, xt->dst_start, xt->numf,
 		xt->frame_size, flags);
 
-	if (unlikely(!xt || xt->numf != 1 || !xt->frame_size))
-		return NULL;
-
 	/*
 	 * The controller can only "skip" X bytes every Y bytes, so we
 	 * need to make sure we are given a template that fit that
-- 
1.7.9.5

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

* [PATCH 1/1] dmaengine: Use Pointer xt after NULL check.
  2015-06-26 10:34 [PATCH 1/1] dmaengine: Use Pointer xt after NULL check Maninder Singh
@ 2015-06-26 12:24 ` Nicolas Ferre
  2015-07-07  4:22 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Ferre @ 2015-06-26 12:24 UTC (permalink / raw)
  To: linux-arm-kernel

Le 26/06/2015 12:34, Maninder Singh a ?crit :
> Removing static analysis error:-
> Possible null pointer dereference: xt
> 
> Because currently xt is dereferenced before NULL check,
> Thus Use it after NULL Check.
> 
> Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
> Reviewed-by: Vaneet Narang <v.narang@samsung.com>

Ok:
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

> ---
>  drivers/dma/at_hdmac.c |    6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
> index 59892126..d313acb 100644
> --- a/drivers/dma/at_hdmac.c
> +++ b/drivers/dma/at_hdmac.c
> @@ -659,14 +659,14 @@ atc_prep_dma_interleaved(struct dma_chan *chan,
>  	size_t			len = 0;
>  	int			i;
>  
> +	if (unlikely(!xt || xt->numf != 1 || !xt->frame_size))
> +		return NULL;
> +
>  	dev_info(chan2dev(chan),
>  		 "%s: src=0x%08x, dest=0x%08x, numf=%d, frame_size=%d, flags=0x%lx\n",
>  		__func__, xt->src_start, xt->dst_start, xt->numf,
>  		xt->frame_size, flags);
>  
> -	if (unlikely(!xt || xt->numf != 1 || !xt->frame_size))
> -		return NULL;
> -
>  	/*
>  	 * The controller can only "skip" X bytes every Y bytes, so we
>  	 * need to make sure we are given a template that fit that
> 


-- 
Nicolas Ferre

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

* [PATCH 1/1] dmaengine: Use Pointer xt after NULL check.
  2015-06-26 10:34 [PATCH 1/1] dmaengine: Use Pointer xt after NULL check Maninder Singh
  2015-06-26 12:24 ` Nicolas Ferre
@ 2015-07-07  4:22 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2015-07-07  4:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jun 26, 2015 at 04:04:48PM +0530, Maninder Singh wrote:
> Removing static analysis error:-
> Possible null pointer dereference: xt
> 
> Because currently xt is dereferenced before NULL check,
> Thus Use it after NULL Check.
> 
Applied, thanks

-- 
~Vinod

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

end of thread, other threads:[~2015-07-07  4:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-26 10:34 [PATCH 1/1] dmaengine: Use Pointer xt after NULL check Maninder Singh
2015-06-26 12:24 ` Nicolas Ferre
2015-07-07  4:22 ` Vinod Koul

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).