[ovs-dev] [PATCH] netdev-offload-dpdk: initialize s_tnl dynamic string

Sriharsha Basavapatna sriharsha.basavapatna at broadcom.com
Sat Aug 14 05:30:08 UTC 2021


On Fri, Aug 13, 2021 at 6:27 PM Gaëtan Rivet <grive at u256.net> wrote:

> On Fri, Aug 13, 2021, at 08:14, Sriharsha Basavapatna via dev wrote:
> > The 's_tnl' member in flow_patterns and flow_actions should be
> > to set to DS_EMPTY_INITIALIZER, to be consistent with dynamic string
> > initializations.
> >
> > Also, there's a potential memory leak of flow_patterns->s_tnl.
> > Fix this by destroying s_tnl in free_flow_patterns().
> >
> > Fixes: 507d20e77bfe ("netdev-offload-dpdk: Support vports flows
> offload.")
> > Fixes: be56e063d028 ("netdev-offload-dpdk: Support tunnel pop action.")
> > Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna at broadcom.com
> >
>
> Hi Harsha,
>
> Thanks for the fix. I have an optional remark below.
> However, I'm not sure it's worth sending a v2 for it, so
> whether it's integrated as-is or modified is fine.
>
> Acked-by: Gaetan Rivet <grive at u256.net>
>
>
Thanks Gaetan, I'll not send out a v2 for this change.
-Harsha

> ---
> >  lib/netdev-offload-dpdk.c | 19 ++++++++++++++++---
> >  1 file changed, 16 insertions(+), 3 deletions(-)
> >
> > diff --git a/lib/netdev-offload-dpdk.c b/lib/netdev-offload-dpdk.c
> > index f6706ee0c..aaf2f9a0b 100644
> > --- a/lib/netdev-offload-dpdk.c
> > +++ b/lib/netdev-offload-dpdk.c
> > @@ -791,6 +791,7 @@ free_flow_patterns(struct flow_patterns *patterns)
> >      free(patterns->items);
> >      patterns->items = NULL;
> >      patterns->cnt = 0;
> > +    ds_destroy(&patterns->s_tnl);
> >  }
> >
> >  static void
> > @@ -1324,7 +1325,11 @@ netdev_offload_dpdk_mark_rss(struct
> > flow_patterns *patterns,
> >                               struct netdev *netdev,
> >                               uint32_t flow_mark)
> >  {
> > -    struct flow_actions actions = { .actions = NULL, .cnt = 0 };
> > +    struct flow_actions actions = {
> > +        .actions = NULL,
> > +        .cnt = 0,
> > +        .s_tnl = DS_EMPTY_INITIALIZER
>
> If the initializer is multi-line, I prefer to always use a terminating
> comma.
> It reduces the diff size when the structure is modified.
>
> --
> Gaetan Rivet
>

-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.


More information about the dev mailing list