[PATCH v5 2/2] net/zxdh: add support flow director ops
Stephen Hemminger
stephen at networkplumber.org
Fri Aug 15 18:01:28 CEST 2025
On Fri, 15 Aug 2025 09:33:17 +0800
fengchengwen <fengchengwen at huawei.com> wrote:
> Hi Stephen,
>
> On 8/15/2025 12:59 AM, Stephen Hemminger wrote:
> > On Thu, 14 Aug 2025 10:52:42 +0800
> > Bingbin Chen <chen.bingbin at zte.com.cn> wrote:
> >
> >> + } else {
> >> + entry = calloc(1, sizeof(struct rte_flow));
> >> + entry_flow = calloc(1, sizeof(struct zxdh_flow));
> >> + TAILQ_FOREACH(entry, &hw->dh_flow_list, next) {
> >> + entry_flow = (struct zxdh_flow *)entry->driver_flow;
> >> + offlow_key_dump(&entry_flow->flowentry.fd_flow.key,
> >> + &entry_flow->flowentry.fd_flow.key_mask, file);
> >> + offlow_result_dump(&entry_flow->flowentry.fd_flow.result, file);
> >> + }
> >> + rte_free(entry_flow);
> >> + rte_free(entry)
> >
> > Use the right free function!
> >
> > ==== 20 line log output for Ubuntu 24.04 (dpdk_unit_test): ====
> > ../drivers/net/zxdh/zxdh_flow.c:641:36: note: returned from 'calloc'
> > 641 | key_mask = calloc(1, sizeof(struct fd_flow_key) * ZXDH_MAX_FLOW_NUM);
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ../drivers/net/zxdh/zxdh_flow.c:689:9: error: 'rte_free' called on pointer returned from a mismatched allocation function [-Werror=mismatched-dealloc]
> > 689 | rte_free(key);
> > | ^~~~~~~~~~~~~
> > ../drivers/net/zxdh/zxdh_flow.c:640:31: note: returned from 'calloc'
> > 640 | key = calloc(1, sizeof(struct fd_flow_key) * ZXDH_MAX_FLOW_NUM);
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > ../drivers/net/zxdh/zxdh_flow.c:690:9: error: 'rte_free' called on pointer returned from a mismatched allocation function [-Werror=mismatched-dealloc]
> > 690 | rte_free(fd_entry);
> > | ^~~~~~~~~~~~~~~~~~
> > ../drivers/net/zxdh/zxdh_flow.c:639:36: note: returned from 'calloc'
> > 639 | fd_entry = calloc(1, sizeof(ZXDH_DTB_ACL_ENTRY_INFO_T) * ZXDH_MAX_FLOW_NUM);
> > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > cc1: all warnings being treated as errors
>
> Just curiosity, which test catch this error? There are no driver rte_flow API test in meson test as I know.
>
> Thanks
>
>
It is caught at compile time with any recent version of Gcc or Clang and glibc.
The function attributes used hint the compiler on what the object free routine is.
More information about the dev
mailing list