[PATCH 4/5] grspw_pkt.c: Fix Dereference before null check (CID #1399846)
Ryan Long
thisisryanlong at gmail.com
Thu Feb 18 14:35:12 UTC 2021
CID 1399846: Dereference before null check in grspw_addr_ctrl().
Closes #4253
---
bsps/shared/grlib/spw/grspw_pkt.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/bsps/shared/grlib/spw/grspw_pkt.c b/bsps/shared/grlib/spw/grspw_pkt.c
index 2cc4e886..ca8767e 100644
--- a/bsps/shared/grlib/spw/grspw_pkt.c
+++ b/bsps/shared/grlib/spw/grspw_pkt.c
@@ -655,7 +655,7 @@ void grspw_hw_support(void *d, struct grspw_hw_sup *hw)
void grspw_addr_ctrl(void *d, struct grspw_addr_config *cfg)
{
struct grspw_priv *priv = d;
- struct grspw_regs *regs = priv->regs;
+ struct grspw_regs *regs;
unsigned int ctrl, nodeaddr;
SPIN_IRQFLAGS(irqflags);
int i;
@@ -663,6 +663,8 @@ void grspw_addr_ctrl(void *d, struct grspw_addr_config *cfg)
if (!priv || !cfg)
return;
+ regs = priv->regs;
+
SPIN_LOCK_IRQ(&priv->devlock, irqflags);
if (cfg->promiscuous != -1) {
--
1.8.3.1
More information about the devel
mailing list