DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
* [dpdk-dev] [PATCH] examples/tep_termination: resolve unchecked return value
@ 2019-11-27 10:33 Shashank T D
  2019-11-27 10:59 ` Li, Xiaoyun
  2019-11-27 12:03 ` [dpdk-dev] [PATCH v2] " Shashank T D
  0 siblings, 2 replies; 4+ messages in thread
From: Shashank T D @ 2019-11-27 10:33 UTC (permalink / raw)
  To: dev; +Cc: xiaoyun.li

resolve the unchecked return value from the function
rte_eth_dev_info_get.
Coverity issue: 349922

Signed-off-by: Shashank T D <shashank.t.d@intel.com>
---
 examples/tep_termination/vxlan_setup.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
index eca119a72..384b3167e 100644
--- a/examples/tep_termination/vxlan_setup.c
+++ b/examples/tep_termination/vxlan_setup.c
@@ -195,7 +195,12 @@ 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)
+			rte_exit(EXIT_FAILURE,
+				"Error during getting device (port %u) info: %s\n",
+				port, strerror(-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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH] examples/tep_termination: resolve unchecked return value
  2019-11-27 10:33 [dpdk-dev] [PATCH] examples/tep_termination: resolve unchecked return value Shashank T D
@ 2019-11-27 10:59 ` Li, Xiaoyun
  2019-11-27 12:03 ` [dpdk-dev] [PATCH v2] " Shashank T D
  1 sibling, 0 replies; 4+ messages in thread
From: Li, Xiaoyun @ 2019-11-27 10:59 UTC (permalink / raw)
  To: T D, Shashank, dev

Hi
The patch is fine. But please polish the commit log first.
You can use expression like "This patch checked the return value of rte_eth_dev_info_get function."

Best Regards,
Xiaoyun Li

> -----Original Message-----
> From: T D, Shashank
> Sent: Wednesday, November 27, 2019 10:34
> To: dev@dpdk.org
> Cc: Li, Xiaoyun <xiaoyun.li@intel.com>
> Subject: [PATCH] examples/tep_termination: resolve unchecked return value
> 
> resolve the unchecked return value from the function rte_eth_dev_info_get.
> Coverity issue: 349922
> 
> Signed-off-by: Shashank T D <shashank.t.d@intel.com>
> ---
>  examples/tep_termination/vxlan_setup.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/tep_termination/vxlan_setup.c
> b/examples/tep_termination/vxlan_setup.c
> index eca119a72..384b3167e 100644
> --- a/examples/tep_termination/vxlan_setup.c
> +++ b/examples/tep_termination/vxlan_setup.c
> @@ -195,7 +195,12 @@ 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)
> +			rte_exit(EXIT_FAILURE,
> +
> 	"Error during getting device (port %u) info: %s\n",
> +				port, strerror(-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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-dev] [PATCH v2] examples/tep_termination: resolve unchecked return value
  2019-11-27 10:33 [dpdk-dev] [PATCH] examples/tep_termination: resolve unchecked return value Shashank T D
  2019-11-27 10:59 ` Li, Xiaoyun
@ 2019-11-27 12:03 ` " Shashank T D
  2019-11-27 13:11   ` Li, Xiaoyun
  1 sibling, 1 reply; 4+ messages in thread
From: Shashank T D @ 2019-11-27 12:03 UTC (permalink / raw)
  To: dev; +Cc: xiaoyun.li

This patch checked the return value of rte_eth_dev_info_get function.
Coverity issue: 349922

Signed-off-by: Shashank T D <shashank.t.d@intel.com>
---
 examples/tep_termination/vxlan_setup.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
index eca119a72..384b3167e 100644
--- a/examples/tep_termination/vxlan_setup.c
+++ b/examples/tep_termination/vxlan_setup.c
@@ -195,7 +195,12 @@ 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)
+			rte_exit(EXIT_FAILURE,
+				"Error during getting device (port %u) info: %s\n",
+				port, strerror(-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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-dev] [PATCH v2] examples/tep_termination: resolve unchecked return value
  2019-11-27 12:03 ` [dpdk-dev] [PATCH v2] " Shashank T D
@ 2019-11-27 13:11   ` Li, Xiaoyun
  0 siblings, 0 replies; 4+ messages in thread
From: Li, Xiaoyun @ 2019-11-27 13:11 UTC (permalink / raw)
  To: T D, Shashank, dev

> -----Original Message-----
> From: T D, Shashank
> Sent: Wednesday, November 27, 2019 12:04
> To: dev@dpdk.org
> Cc: Li, Xiaoyun <xiaoyun.li@intel.com>
> Subject: [PATCH v2] examples/tep_termination: resolve unchecked return value
> 
> This patch checked the return value of rte_eth_dev_info_get function.
> Coverity issue: 349922
> 
> Signed-off-by: Shashank T D <shashank.t.d@intel.com>
> ---
>  examples/tep_termination/vxlan_setup.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/examples/tep_termination/vxlan_setup.c
> b/examples/tep_termination/vxlan_setup.c
> index eca119a72..384b3167e 100644
> --- a/examples/tep_termination/vxlan_setup.c
> +++ b/examples/tep_termination/vxlan_setup.c
> @@ -195,7 +195,12 @@ 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)
> +			rte_exit(EXIT_FAILURE,
> +
> 	"Error during getting device (port %u) info: %s\n",
> +				port, strerror(-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: Xiaoyun Li <Xiaoyun.li@intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-27 10:33 [dpdk-dev] [PATCH] examples/tep_termination: resolve unchecked return value Shashank T D
2019-11-27 10:59 ` Li, Xiaoyun
2019-11-27 12:03 ` [dpdk-dev] [PATCH v2] " Shashank T D
2019-11-27 13:11   ` Li, Xiaoyun

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org
	public-inbox-index dpdk-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git