From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 55F4BA00E6 for ; Thu, 21 Mar 2019 10:07:30 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 699681B452; Thu, 21 Mar 2019 10:07:29 +0100 (CET) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140045.outbound.protection.outlook.com [40.107.14.45]) by dpdk.org (Postfix) with ESMTP id A160B1B44E for ; Thu, 21 Mar 2019 10:07:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eCNERlxQ75kBfyuPPvgC1yiPHSOHJmIa0ylPareW32M=; b=YfBaEv5wYb783R0/KNayp88HBM568XEYBzWbnLhXcsBhW8vB5d+yGUu/vgUVuHTVSbgjrs9iC3vfMCbJyHgfNuRH95dKyYPcnKc4KjeuGbUa0YYoDqKahtFsUgc1CsxbsaG72NrTldC/aowY3uCIdey3NJVsVPfNiqEblVJxpqc= Received: from VI1PR05MB4269.eurprd05.prod.outlook.com (52.133.12.22) by VI1PR05MB3328.eurprd05.prod.outlook.com (10.170.238.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1709.14; Thu, 21 Mar 2019 09:07:26 +0000 Received: from VI1PR05MB4269.eurprd05.prod.outlook.com ([fe80::55ef:d19:7985:4c7f]) by VI1PR05MB4269.eurprd05.prod.outlook.com ([fe80::55ef:d19:7985:4c7f%4]) with mapi id 15.20.1709.017; Thu, 21 Mar 2019 09:07:26 +0000 From: Ali Alnubani To: "dev@dpdk.org" CC: Shahaf Shuler , Dekel Peled Thread-Topic: [PATCH] net/mlx5: add missing return value check Thread-Index: AQHU38WAY+2M9ex/ak+E9IrZesqPuw== Date: Thu, 21 Mar 2019 09:07:26 +0000 Message-ID: <20190321090652.32535-1-alialnu@mellanox.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.19.2 x-clientproxiedby: LO2P265CA0215.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:9e::35) To VI1PR05MB4269.eurprd05.prod.outlook.com (2603:10a6:803:40::22) authentication-results: spf=none (sender IP is ) smtp.mailfrom=alialnu@mellanox.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [37.142.13.130] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1397f7e7-aad2-474d-dd9c-08d6addca300 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600127)(711020)(4605104)(4618075)(2017052603328)(7153060)(7193020); SRVR:VI1PR05MB3328; x-ms-traffictypediagnostic: VI1PR05MB3328: x-microsoft-antispam-prvs: x-forefront-prvs: 0983EAD6B2 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(366004)(39860400002)(396003)(136003)(376002)(346002)(189003)(199004)(6436002)(107886003)(5640700003)(256004)(478600001)(86362001)(68736007)(99286004)(36756003)(52116002)(26005)(386003)(71200400001)(106356001)(50226002)(6512007)(2351001)(6506007)(8936002)(71190400001)(102836004)(54906003)(105586002)(3846002)(2906002)(186003)(2501003)(5660300002)(6916009)(476003)(66066001)(486006)(97736004)(8676002)(1076003)(6116002)(14454004)(81166006)(4326008)(81156014)(53936002)(25786009)(305945005)(1730700003)(7736002)(316002)(6486002)(2616005); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR05MB3328; H:VI1PR05MB4269.eurprd05.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; received-spf: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: jOHrnzK35zxaRmYX5f1KFSlYVjs5d85gdkhgGpA5zP1uyaeaJDwbnP1AWP4xzw3DDrRUmMzqE7jo5m0FLH09JVHyvJ6kmwdSqaWZuAGV8ygcATbZ6pvPZiyyD3EzIPzW8Uk6XdNND0X+WGmsIIsuqXYc6xGDo/1NE+MMHqoJTnVoVpXGn20eoPt6Ncf8L2MJ437tj36SH/UX+T6o+7U6nDNPu5NKkwK4drQBGhZ+F9qpegrKk7PGjggK2iJIkQe2ULmWfAa3m7RIZWRtuePI3BONyOeWApxM+mwL91HBTTpnKGwlX9Fzq66vHgS+QRvHtX/RItG2a+qGr+mKjUCaAxkrhsgaW/5Zyn0apv1oUDKpiAtKOdEEqOZEeaRaz8DJBMZj/yeac3To8EIvDR0SONyr9x3dg1qavdrqKYgY3Jk= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1397f7e7-aad2-474d-dd9c-08d6addca300 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Mar 2019 09:07:26.3159 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR05MB3328 Subject: [dpdk-dev] [PATCH] net/mlx5: add missing return value check X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Message-ID: <20190321090726.J6haKVk7v3p21uz9RcaqMVbYk6HGX0gi-jNHSYJuRRQ@z> Fixes: d86406b965df ("net/mlx5: support new representor naming format") Cc: dekelp@mellanox.com Signed-off-by: Ali Alnubani --- 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 m= lx5_switch_info *info) bool port_name_set =3D false; bool port_switch_id_set =3D false; char c; + int ret; =20 if (!if_indextoname(ifindex, ifname)) { rte_errno =3D errno; @@ -1378,9 +1379,10 @@ mlx5_sysfs_switch_info(unsigned int ifindex, struct = mlx5_switch_info *info) =20 file =3D fopen(phys_port_name, "rb"); if (file !=3D NULL) { - fscanf(file, "%s", port_name); + ret =3D fscanf(file, "%s", port_name); fclose(file); - port_name_set =3D mlx5_translate_port_name(port_name, &data); + if (ret =3D=3D 1) + port_name_set =3D mlx5_translate_port_name(port_name, &data); } file =3D fopen(phys_switch_id, "rb"); if (file =3D=3D NULL) { --=20 2.19.2