grspw_pkt.c: Fix Dereference before null check (CID #1399846)

CID 1399846: Dereference before null check in grspw_addr_ctrl().

Closes #4253
This commit is contained in:
Ryan Long
2021-02-16 17:39:30 -05:00
committed by Joel Sherrill
parent 1fd56a96fc
commit fac1ff1820

View File

@@ -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) {