[v2] examples/tep_term: fix return value check
Checks
Commit Message
Added return value check for 'rte_eth_dev_info_get()'.
Coverity issue: 349922
Fixes: 2bb43bd4350a ("examples/tep_term: add TSO offload configuration")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
---
examples/tep_termination/vxlan_setup.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Comments
On 02/10, Xiaoyun Li wrote:
>Added return value check for 'rte_eth_dev_info_get()'.
>
>Coverity issue: 349922
>Fixes: 2bb43bd4350a ("examples/tep_term: add TSO offload configuration")
>Cc: stable@dpdk.org
>
>Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
>---
> examples/tep_termination/vxlan_setup.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
>diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
>index eca119a72..f8385b690 100644
>--- a/examples/tep_termination/vxlan_setup.c
>+++ b/examples/tep_termination/vxlan_setup.c
>@@ -195,7 +195,9 @@ vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool)
>
> if (tso_segsz != 0) {
> struct rte_eth_dev_info dev_info;
>- rte_eth_dev_info_get(port, &dev_info);
>+ retval = rte_eth_dev_info_get(port, &dev_info);
>+ if (retval != 0)
>+ return retval;
> if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) == 0)
> RTE_LOG(WARNING, PORT,
> "hardware TSO offload is not supported\n");
>--
>2.17.1
>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
On Mon, Feb 10, 2020 at 8:05 AM Xiaoyun Li <xiaoyun.li@intel.com> wrote:
>
> Added return value check for 'rte_eth_dev_info_get()'.
>
> Coverity issue: 349922
> Fixes: 2bb43bd4350a ("examples/tep_term: add TSO offload configuration")
rte_eth_dev_info_get() prototype changed in 19.11.
Before this, it was a void.
So this Fixes: line is wrong.
> Cc: stable@dpdk.org
>
> Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
> ---
> examples/tep_termination/vxlan_setup.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
> index eca119a72..f8385b690 100644
> --- a/examples/tep_termination/vxlan_setup.c
> +++ b/examples/tep_termination/vxlan_setup.c
> @@ -195,7 +195,9 @@ vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool)
>
> if (tso_segsz != 0) {
> struct rte_eth_dev_info dev_info;
> - rte_eth_dev_info_get(port, &dev_info);
> + retval = rte_eth_dev_info_get(port, &dev_info);
> + if (retval != 0)
> + return retval;
> if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) == 0)
> RTE_LOG(WARNING, PORT,
> "hardware TSO offload is not supported\n");
I had a look at this function, dev_info is populated for port earlier
in the function, why do we need to check it again?
https://git.dpdk.org/dpdk/tree/examples/tep_termination/vxlan_setup.c?h=v20.02-rc2#n119
Hi
> -----Original Message-----
> From: David Marchand [mailto:david.marchand@redhat.com]
> Sent: Thursday, February 13, 2020 22:57
> To: Li, Xiaoyun <xiaoyun.li@intel.com>
> Cc: Ye, Xiaolong <xiaolong.ye@intel.com>; Kovacevic, Marko
> <marko.kovacevic@intel.com>; dev <dev@dpdk.org>; dpdk stable
> <stable@dpdk.org>
> Subject: Re: [dpdk-dev] [PATCH v2] examples/tep_term: fix return value check
>
> On Mon, Feb 10, 2020 at 8:05 AM Xiaoyun Li <xiaoyun.li@intel.com> wrote:
> >
> > Added return value check for 'rte_eth_dev_info_get()'.
> >
> > Coverity issue: 349922
> > Fixes: 2bb43bd4350a ("examples/tep_term: add TSO offload
> > configuration")
>
> rte_eth_dev_info_get() prototype changed in 19.11.
> Before this, it was a void.
> So this Fixes: line is wrong.
>
>
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
> > ---
> > examples/tep_termination/vxlan_setup.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/examples/tep_termination/vxlan_setup.c
> > b/examples/tep_termination/vxlan_setup.c
> > index eca119a72..f8385b690 100644
> > --- a/examples/tep_termination/vxlan_setup.c
> > +++ b/examples/tep_termination/vxlan_setup.c
> > @@ -195,7 +195,9 @@ vxlan_port_init(uint16_t port, struct rte_mempool
> > *mbuf_pool)
> >
> > if (tso_segsz != 0) {
> > struct rte_eth_dev_info dev_info;
> > - rte_eth_dev_info_get(port, &dev_info);
> > + retval = rte_eth_dev_info_get(port, &dev_info);
> > + if (retval != 0)
> > + return retval;
> > if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) == 0)
> > RTE_LOG(WARNING, PORT,
> > "hardware TSO offload is not
> > supported\n");
>
> I had a look at this function, dev_info is populated for port earlier in the function,
> why do we need to check it again?
> https://git.dpdk.org/dpdk/tree/examples/tep_termination/vxlan_setup.c?h=v20
> .02-rc2#n119
Yes. I saw it too. And since it only uses tx_offload_capa which is fixed nic capability, I think can use dev_info directly without calling rte_eth_dev_info_get again.
Will send v3 as that. Then the fix line should be the same as this patch too.
Thanks.
>
>
> --
> David Marchand
@@ -195,7 +195,9 @@ vxlan_port_init(uint16_t port, struct rte_mempool *mbuf_pool)
if (tso_segsz != 0) {
struct rte_eth_dev_info dev_info;
- rte_eth_dev_info_get(port, &dev_info);
+ retval = rte_eth_dev_info_get(port, &dev_info);
+ if (retval != 0)
+ return retval;
if ((dev_info.tx_offload_capa & DEV_TX_OFFLOAD_TCP_TSO) == 0)
RTE_LOG(WARNING, PORT,
"hardware TSO offload is not supported\n");