On 1/16/2020 10:56 PM, Stephen Hemminger wrote: > On Thu, 16 Jan 2020 20:37:36 +0000 > Ferruh Yigit <ferruh.yi...@intel.com> wrote: > >> On 1/16/2020 10:14 AM, Xiaoyu Min wrote: >>> Introduce an API which dump the device's internal representation >>> information of rte flows in hardware. >>> >>> Signed-off-by: Xiaoyu Min <jack...@mellanox.com> >> >> <...> >> >>> @@ -1212,3 +1212,19 @@ rte_flow_expand_rss(struct rte_flow_expand_rss *buf, >>> size_t size, >>> } >>> return lsize; >>> } >>> + >>> +int >>> +rte_flow_dev_dump(uint16_t port_id, FILE *file, struct rte_flow_error >>> *error) >>> +{ >>> + struct rte_eth_dev *dev = &rte_eth_devices[port_id]; >>> + const struct rte_flow_ops *ops = rte_flow_ops_get(port_id, error); >>> + >>> + if (unlikely(!ops)) >>> + return -rte_errno; >>> + if (likely(!!ops->dev_dump)) >>> + return flow_err(port_id, ops->dev_dump(dev, file, error), >>> + error); >>> + return rte_flow_error_set(error, ENOSYS, >>> + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, >>> + NULL, rte_strerror(ENOSYS)); >>> +} >> >> Should API validate user provided input "FILE *file" ? > > None of the other DPDK dump routines do. >
You are right, a few samples I checked doesn't validating it, I wonder if this is intentional decision or just missed the user input validation. For me, APIs should validate user input.