DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: add missing return value check
@ 2019-03-21  9:07 Ali Alnubani
  2019-03-21  9:07 ` Ali Alnubani
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Ali Alnubani @ 2019-03-21  9:07 UTC (permalink / raw)
  To: dev; +Cc: Shahaf Shuler, Dekel Peled

Fixes: d86406b965df ("net/mlx5: support new representor naming format")
Cc: dekelp@mellanox.com

Signed-off-by: Ali Alnubani <alialnu@mellanox.com>
---
 drivers/net/mlx5/mlx5_ethdev.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_ethdev.c b/drivers/net/mlx5/mlx5_ethdev.c
index 84d761c8e..1fd988998 100644
--- a/drivers/net/mlx5/mlx5_ethdev.c
+++ b/drivers/net/mlx5/mlx5_ethdev.c
@@ -1365,6 +1365,7 @@ mlx5_sysfs_switch_info(unsigned int ifindex, struct mlx5_switch_info *info)
 	bool port_name_set = false;
 	bool port_switch_id_set = false;
 	char c;
+	int ret;
 
 	if (!if_indextoname(ifindex, ifname)) {
 		rte_errno = errno;
@@ -1378,9 +1379,10 @@ mlx5_sysfs_switch_info(unsigned int ifindex, struct mlx5_switch_info *info)
 
 	file = fopen(phys_port_name, "rb");
 	if (file != NULL) {
-		fscanf(file, "%s", port_name);
+		ret = fscanf(file, "%s", port_name);
 		fclose(file);
-		port_name_set = mlx5_translate_port_name(port_name, &data);
+		if (ret == 1)
+			port_name_set = mlx5_translate_port_name(port_name, &data);
 	}
 	file = fopen(phys_switch_id, "rb");
 	if (file == NULL) {
-- 
2.19.2

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

end of thread, other threads:[~2019-03-28 18:28 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-21  9:07 [dpdk-dev] [PATCH] net/mlx5: add missing return value check Ali Alnubani
2019-03-21  9:07 ` Ali Alnubani
2019-03-21  9:26 ` Slava Ovsiienko
2019-03-21  9:26   ` Slava Ovsiienko
2019-03-21  9:34 ` Dekel Peled
2019-03-21  9:34   ` Dekel Peled
2019-03-24  9:26   ` Shahaf Shuler
2019-03-24  9:26     ` Shahaf Shuler
2019-03-25 12:02     ` Ferruh Yigit
2019-03-25 12:02       ` Ferruh Yigit
2019-03-27  9:31       ` Ferruh Yigit
2019-03-27  9:31         ` Ferruh Yigit
2019-03-28 10:29         ` Ali Alnubani
2019-03-28 10:29           ` Ali Alnubani
2019-03-28 18:28           ` Ferruh Yigit
2019-03-28 18:28             ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).