ons. 24. mai 2023, 21:31 skrev Ilya Maximets <i.maxim...@ovn.org>:

> On 5/23/23 12:39, Frode Nordahl wrote:
>
> <snip>
>
> >  int
> >  tc_transact(struct ofpbuf *request, struct ofpbuf **replyp)
> >  {
> >      int error = nl_transact(NETLINK_ROUTE, request, replyp);
> >      ofpbuf_uninit(request);
> > +
> > +    if (!error && replyp && !(*replyp)->size) {
>
> Not a full review, but shouldn't we also check that *replyp != NULL
> here?  This can happen, for example, if nl_pool_alloc() fails.
>

In the event of `nl_pool_alloc()` failing, would not error also have a
value?

In any case, it probably would not hurt with a extra check before
dereferencing the pointer, thank you for pointing it out.

--
Frode Nordahl

> +        COVERAGE_INC(tc_transact_eagain);
> > +        /* We replicate the behavior of `nl_transact` for error
> conditions and
> > +         * free any allocations before setting the 'replyp' buffer to
> NULL. */
> > +        ofpbuf_delete(*replyp);
> > +        *replyp = NULL;
> > +        return EAGAIN;
> > +    }
> > +
> >      return error;
> >  }
> >
>
> Bets regards, Ilya Maximets.
>
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to