[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1347875423-7970-1-git-send-email-sachin.kamat@linaro.org>
Date: Mon, 17 Sep 2012 15:20:22 +0530
From: Sachin Kamat <sachin.kamat@...aro.org>
To: linux-kernel@...r.kernel.org
Cc: vinod.koul@...el.com, jassisinghbrar@...il.com,
sachin.kamat@...aro.org, patches@...aro.org
Subject: [PATCH 1/2] DMA: PL330: Fix potential NULL pointer dereference in pl330_submit_req()
'r->cfg' is being checked for NULL. However, it is dereferenced
in the previous statements. Thus moving those statements within
the check.
Signed-off-by: Sachin Kamat <sachin.kamat@...aro.org>
---
drivers/dma/pl330.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 2343d7d..018a445 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -1567,17 +1567,19 @@ static int pl330_submit_req(void *ch_id, struct pl330_req *r)
goto xfer_exit;
}
- /* Prefer Secure Channel */
- if (!_manager_ns(thrd))
- r->cfg->nonsecure = 0;
- else
- r->cfg->nonsecure = 1;
/* Use last settings, if not provided */
- if (r->cfg)
+ if (r->cfg) {
+ /* Prefer Secure Channel */
+ if (!_manager_ns(thrd))
+ r->cfg->nonsecure = 0;
+ else
+ r->cfg->nonsecure = 1;
+
ccr = _prepare_ccr(r->cfg);
- else
+ } else {
ccr = readl(regs + CC(thrd->id));
+ }
/* If this req doesn't have valid xfer settings */
if (!_is_valid(ccr)) {
--
1.7.4.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists