DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ali Alnubani <alialnu@mellanox.com>
To: "dev@dpdk.org" <dev@dpdk.org>
Cc: Shahaf Shuler <shahafs@mellanox.com>, Dekel Peled <dekelp@mellanox.com>
Subject: [dpdk-dev] [PATCH] net/mlx5: add missing return value check
Date: Thu, 21 Mar 2019 09:07:26 +0000	[thread overview]
Message-ID: <20190321090652.32535-1-alialnu@mellanox.com> (raw)

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

             reply	other threads:[~2019-03-21  9:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-21  9:07 Ali Alnubani [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190321090652.32535-1-alialnu@mellanox.com \
    --to=alialnu@mellanox.com \
    --cc=dekelp@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=shahafs@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).