[PATCH 4/5] grspw_pkt.c: Fix Dereference before null check (CID #1399846)
Gedare Bloom
gedare at rtems.org
Thu Feb 18 18:08:03 UTC 2021
CC: Cobham Gaisler
The patches look good, but they touch grlib. I'm not sure if grlib in
rtems.git is "authoritative" or if Cobham Gaisler maintains an
upstream. So I'd like Daniel or someone to comment/approve before
these go in, and we should probably get to know that relationship and
document it in the sources.
Gedare
On Thu, Feb 18, 2021 at 7:35 AM Ryan Long <thisisryanlong at gmail.com> wrote:
>
> 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
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
More information about the devel
mailing list