public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RESEND PATCH v2 1/4] dmaengine: pl330: Remove non-NULL check for pl330_submit_req parameters
@ 2014-09-29 12:42 Krzysztof Kozlowski
  2014-09-29 12:42 ` [RESEND PATCH v2 2/4] dmaengine: pl330: Remove unused 'regs' variable in pl330_submit_req() Krzysztof Kozlowski
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Krzysztof Kozlowski @ 2014-09-29 12:42 UTC (permalink / raw)
  To: Vinod Koul, Dan Williams, Lars-Peter Clausen, Michal Simek,
	Dan Carpenter, dmaengine, linux-kernel
  Cc: Kyungmin Park, Marek Szyprowski, Bartlomiej Zolnierkiewicz,
	Krzysztof Kozlowski

The pl330_submit_req() checked supplied 'struct pl330_thread thrd' and
'struct dma_pl330_desc desc' parameters for non-NULL. However these
checks are useless because supplied arguments won't be NULL.

The pl330_submit_req() is called in only one place and:
1. 'desc' is already dereferenced in fill_queue() before calling
   pl330_submit_req().
2. 'thrd' is always dereferenced after calling
   fill_queue()->pl330_submit_req().

Removing the checks for non-NULL values fixes following warning:
drivers/dma/pl330.c:1376 pl330_submit_req() warn: variable dereferenced before check 'thrd' (see line 1367)

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>

---

Changes since v1:
=================
1. Remove the checks for non-NULL completely instead of moving them
   before dereference. Suggested by Lars-Peter Clausen.
---
 drivers/dma/pl330.c | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index d5149aacd2fe..57049f84d0c0 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -1372,10 +1372,6 @@ static int pl330_submit_req(struct pl330_thread *thrd,
 	u32 ccr;
 	int ret = 0;
 
-	/* No Req or Unacquired Channel or DMAC */
-	if (!desc || !thrd || thrd->free)
-		return -EINVAL;
-
 	regs = thrd->dmac->base;
 
 	if (pl330->state == DYING
-- 
1.9.1


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

end of thread, other threads:[~2014-10-15  8:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-29 12:42 [RESEND PATCH v2 1/4] dmaengine: pl330: Remove non-NULL check for pl330_submit_req parameters Krzysztof Kozlowski
2014-09-29 12:42 ` [RESEND PATCH v2 2/4] dmaengine: pl330: Remove unused 'regs' variable in pl330_submit_req() Krzysztof Kozlowski
2014-10-14 12:02   ` Vinod Koul
2014-09-29 12:42 ` [RESEND PATCH v2 3/4] dmaengine: pl330: Fix NULL pointer dereference on probe failure Krzysztof Kozlowski
2014-10-14 12:03   ` Vinod Koul
2014-09-29 12:42 ` [RESEND PATCH v2 4/4] dmaengine: pl330: Fix NULL pointer dereference on driver unbind Krzysztof Kozlowski
2014-10-14 12:03   ` Vinod Koul
2014-10-14 11:51 ` [RESEND PATCH v2 1/4] dmaengine: pl330: Remove non-NULL check for pl330_submit_req parameters Vinod Koul
2014-10-14 12:40   ` Lars-Peter Clausen
2014-10-15  7:57     ` Vinod Koul
2014-10-14 12:44   ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox