[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20200203100916.19057-1-peter.ujfalusi@ti.com>
Date: Mon, 3 Feb 2020 12:09:16 +0200
From: Peter Ujfalusi <peter.ujfalusi@...com>
To: <grygorii.strashko@...com>, <ssantosh@...nel.org>,
<santosh.shilimkar@...cle.com>
CC: <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <dan.carpenter@...cle.com>,
<t-kristo@...com>
Subject: [PATCH] soc: ti: k3-ringacc: Fix dereference before NULL check in k3_ringacc_ring_cfg()
Only dereference ring->parent after we have checked that ring is not NULL.
Fixes: 3277e8aa2504 ("soc: ti: k3: add navss ringacc driver")
Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@...com>
---
drivers/soc/ti/k3-ringacc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/ti/k3-ringacc.c b/drivers/soc/ti/k3-ringacc.c
index 5fb2ee2ac978..8f90cc56d44d 100644
--- a/drivers/soc/ti/k3-ringacc.c
+++ b/drivers/soc/ti/k3-ringacc.c
@@ -556,11 +556,13 @@ static int k3_ringacc_ring_cfg_sci(struct k3_ring *ring)
int k3_ringacc_ring_cfg(struct k3_ring *ring, struct k3_ring_cfg *cfg)
{
- struct k3_ringacc *ringacc = ring->parent;
+ struct k3_ringacc *ringacc;
int ret = 0;
if (!ring || !cfg)
return -EINVAL;
+
+ ringacc = ring->parent;
if (cfg->elm_size > K3_RINGACC_RING_ELSIZE_256 ||
cfg->mode >= K3_RINGACC_RING_MODE_INVALID ||
cfg->size & ~K3_RINGACC_CFG_RING_SIZE_ELCNT_MASK ||
--
Peter
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
Powered by blists - more mailing lists