From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A93F5A054F; Tue, 16 Mar 2021 06:43:49 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D3EE4069F; Tue, 16 Mar 2021 06:43:49 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 400B640042 for ; Tue, 16 Mar 2021 06:43:47 +0100 (CET) IronPort-SDR: q2lgK+Z0ytJRosv/FxTkC7eqBCh5ev3jonsC6cRwuKa/xELBH7uN7/6/KAKe0qFBlCDfu7yuGc 9snKANP8U9dQ== X-IronPort-AV: E=McAfee;i="6000,8403,9924"; a="168478239" X-IronPort-AV: E=Sophos;i="5.81,251,1610438400"; d="scan'208";a="168478239" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Mar 2021 22:43:46 -0700 IronPort-SDR: iukcDWz0b8ZFSup3ZlwMhVqEYNiMEmmfsGJbxJ36b/w5tq7pyQjQA9d/YkPGDICylBjdjQf68S YdqCpq8c9v/g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,251,1610438400"; d="scan'208";a="601709655" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by fmsmga006.fm.intel.com with ESMTP; 15 Mar 2021 22:43:46 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx604.amr.corp.intel.com (10.18.126.84) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 15 Mar 2021 22:43:45 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Mon, 15 Mar 2021 22:43:45 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Mon, 15 Mar 2021 22:43:45 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.104) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Mon, 15 Mar 2021 22:43:45 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NhETduznoyeQmTWserB77UBoSlfNvrb1vt/TLO7r47WK0KQAM3zaYdXeOeYBeFDP7rbk9xbVVbefbcbxteQgo2efLuyb/7dpH7tMEd6dhS5ZI6ZfdlrMvKYTWtIBVuctTX4qrNYzzw8AjNnH4GEZ9PqsRELfi9C3S3KmiI5PKU+4/VN9zIeqgA/4aHrm46hwH1eJEX0hO8jGvPofoTGZTVnLMB7MAgqRoWti8nM8bY1Qi6D+qzfh1K9+kB+kPM12mYUZLGjm5lcUt5fqk4ErhRpa6rofAlRbIDG+Mch11h4cSstd2nUlSTfu2n9Xex4aODB0qEX6O1YMikgRBtJoig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TnMzDb05d8rEkohnz2LKYGsO7F4K6/cDCkYZZDcysrU=; b=ZBVZQhxh2BtIWijCKk2d4AVw6nUr3lDTyHOUgthjRsrRZce+oehRD7D05WMnbgsQwVoSHe4c3yJLVXJofIqavAqrlBMlzgbhzxmHk05E75vddHLXtFyxRL5+UdMmx4Mivi3iJVzKUjcRuwlRZI+Kd19ovbSLfJuEd02Ae6/DLomDRBY0YRXAvfghE/RCzi6yLOVR0yBc5jUxMa0CUXQCLAGZWFl/Qti20EOhC1GlD4iVtW47qUR+JJ0IYuHHPD3vXDAvhaVTCSCEbUS2jYcvc+hSTkdzqlpNY9n9XQ86Weiw9oEq/ZB+wLaf6DBoQMKWoAoOGRyxieARgXxE9bX59g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TnMzDb05d8rEkohnz2LKYGsO7F4K6/cDCkYZZDcysrU=; b=PZHMERQBPnPoE2SdZxXH4ELWWGtGbn80Iji/IIHNhQ2Oa4KW9P1xoMnuf/yM+1PU1Xrk3QjEt37HNeHsHLUs0nOpcVWmDcuIxTivJvdC5XZKuOmXSSvfaXYqZhWY85obyV13J9UjDcgaT0Ol/rZA5oqWxAwAaE/Kz8ZZicMyqok= Received: from MWHPR11MB1757.namprd11.prod.outlook.com (2603:10b6:300:109::17) by MWHPR1101MB2158.namprd11.prod.outlook.com (2603:10b6:301:59::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.32; Tue, 16 Mar 2021 05:43:28 +0000 Received: from MWHPR11MB1757.namprd11.prod.outlook.com ([fe80::50:348e:ff31:d301]) by MWHPR11MB1757.namprd11.prod.outlook.com ([fe80::50:348e:ff31:d301%6]) with mapi id 15.20.3933.032; Tue, 16 Mar 2021 05:43:28 +0000 From: "Li, Xiaoyun" To: Kalesh A P , "dev@dpdk.org" CC: "Yigit, Ferruh" Thread-Topic: [dpdk-dev] [PATCH] app/testpmd: fix unchecked return value Thread-Index: AQHXGh17M7jM7LV6aE+I0H8+fAMBFqqGFaPg Date: Tue, 16 Mar 2021 05:43:27 +0000 Message-ID: References: <20210316045518.20234-1-kalesh-anakkur.purayil@broadcom.com> In-Reply-To: <20210316045518.20234-1-kalesh-anakkur.purayil@broadcom.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: broadcom.com; dkim=none (message not signed) header.d=none;broadcom.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.55.46.54] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 036060f1-943d-4583-304a-08d8e83e6cbd x-ms-traffictypediagnostic: MWHPR1101MB2158: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:3513; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 3YsUbX5ar3IiMX2jO1cMc6cJd1RuwC7VvLgmvh3um8uJ3PMMsqS1z0x0gmwu/SKAr20l2Nml0KT9n9YkdSmPTp9SnPyJrqgBl/YdISnmkQxkp00lD8Bdv33uppPo9XNfh2w0LzVvVpI6EzGvujSXZVr8szKzVIZ9JIRSo5lcQh6B7yXe9SdzgEsFMg2Wf1DYmlBvrflXYsjllvFfQu6RuNv1A2Om/Q/1OACar0XwFA/SPlFpoN+2B45k7iHPZwdjv11NfLpp8t0K7YMuHpjm+AJNBd4vxZA3MruVyxnaAxSaxOBbaRdS5cd6Lv4AnxmWpIgAdIksbPmTu/hrjwVU7mY61fmC4QVhxyedIB94L0ZPs8Zgv2HLJ7ewBH+7eMT4HycqpGT6g0kJ7E7L/rQKo4wPld/Rk9py76dhsaqqA2GVeaOb64+48mscDkLIQ0o9Irsh6dohqwN7T0YcMJyYZBAeqCmROuqMojOhnF6JZGk3qWy5ohzubiypdPS7J+0fZA+44OxS7/qBizawjcfrFXdBjH1M3uLmpnQzqy4UGIBpj0syn8hYQ+5/Qi09+u/n x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MWHPR11MB1757.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(39860400002)(366004)(396003)(376002)(136003)(346002)(6506007)(110136005)(66446008)(26005)(66556008)(53546011)(316002)(76116006)(66946007)(66476007)(8936002)(7696005)(64756008)(71200400001)(9686003)(5660300002)(86362001)(478600001)(33656002)(4326008)(8676002)(83380400001)(2906002)(186003)(52536014)(55016002)(107886003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?OpqZ4PKtIeBXfad90S2sKwYt+hEkCT3APPzkqPOwa8se4sTX8pEIWisQt+Sd?= =?us-ascii?Q?duJclMDud6kYRF+CIBq4CZseOcD3Og/iLC0m08BbrZxiIZPo8o3lFt4mQcVs?= =?us-ascii?Q?5nEbdFigoInBlhvqFkQEklwwpWWFbK6xj/Uk9e/2HgGhKiqU/6aFMpWfsJP+?= =?us-ascii?Q?VCdIKI17Us+E9I6s/76PTz/MddNFtFnb76KNkDL8ozzf1HrKl8WHux82f9mV?= =?us-ascii?Q?GqNNecyhL9DVFRB/PdbC1XvquGnTkFyegWzdjJR0xH2b7oRZnKa2oTQzKino?= =?us-ascii?Q?DNJomTt5KDlmmMEgi5eFx1++915OhKnorQbmyuO+v7JuUH+lcbZpMp3wQQD/?= =?us-ascii?Q?Em2NpfaVPUWIHwV5kfHIggIdloCrXeYfkUkKqejiI+EaehHHnVm2DEA3iiaY?= =?us-ascii?Q?kDhGTtvkBOSPsSjcuFulkJvnY7eUSqTYj8rJbQcrqbw2kITFx3o+SNqQRk+j?= =?us-ascii?Q?Ym889+7PQZ6EQi7jPlJeY2hpkYcTY/KIJv3LMrCozGEjwztwi8QPtnogMopL?= =?us-ascii?Q?hDe+6cgLGvDYft1AeBTc4swU6iGYtzp76tTojFO/e73KEARpEH+EFDc3n7xB?= =?us-ascii?Q?WfQca0DdlApD9FDO/0QUZDtipNIUpuusLp8ohRtSmLomNc3OAuCBDRLQlQKh?= =?us-ascii?Q?/rh5VevUhMDs+YNNhC+32Lgpymeb+BCIW2/fQI8LQVFJWQsv6KN35rZkUFA/?= =?us-ascii?Q?2TeuI7hvsg1GgsVdGrKs7QQYs4k16eZjHn2TNmpksz16qP15luKYhJr9R/QX?= =?us-ascii?Q?TUiQQl+lg9ZooGTKsXbdNiKsJMj5nyJgKvucRMTKiQral0V7h1hSSw3dG7AT?= =?us-ascii?Q?q9nJezRshWkIE3M0vKpntoS6ly+zb/gkFxcstiLQHlICWrAgmO8f/ZzrnPGY?= =?us-ascii?Q?KNtDEk3bLP+ScbNc7HfqXC1jhBnZquz3F18xKdDoUGwf7iRHZ4d5wJ0X3RPB?= =?us-ascii?Q?4uAeVxLiq8DT8K4W9MPYCGRrCdkYWcLIP0u0nEc9XfU42t9KLGk3ilP5g1qQ?= =?us-ascii?Q?2G5o5BLiErcc1KWRDVvASx1GV5yH0VdHdj5bqgweKM6yHT+YlizsoF+u7I5p?= =?us-ascii?Q?XNW9u5SCnNgyA7t60WK6y/3WxYbHmkxpy9Ft0mpyGdYDiJliIq3zDphTpzMm?= =?us-ascii?Q?6juv0fhecV+lqWblb5JNpCco/dRvguB8DWfnCniyLDbVTSae9Ep8PrHRg67F?= =?us-ascii?Q?CZzvTGMpZreNWNaiX8d7/MneqpxuXTCSrvPHzGaTQ+jFUIbv5k9Jqo5WsjQ4?= =?us-ascii?Q?j1ZykDmM1KAn3F2YRZMkAlamGG5Ei4yzPrqYrUcQvE3D+/TQaZJusHb+FyMW?= =?us-ascii?Q?8U8=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR11MB1757.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 036060f1-943d-4583-304a-08d8e83e6cbd X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Mar 2021 05:43:28.1300 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: cpqKlf3Ujl2uAjG+fP8FxqxjuGvSVbnfJDqpWF+YZqDvEe2LRcs4hsa4AlAuCnOO/O0BZgI3Dos8tz4JzCyPCg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1101MB2158 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix unchecked return value X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 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" Hi > -----Original Message----- > From: Kalesh A P > Sent: Tuesday, March 16, 2021 12:55 > To: dev@dpdk.org > Cc: Li, Xiaoyun ; Yigit, Ferruh > Subject: [dpdk-dev] [PATCH] app/testpmd: fix unchecked return value >=20 > From: Kalesh AP >=20 > CID 353629 (#1 of 1): Unchecked return value (CHECKED_RETURN) > check_return: Calling rte_eth_dev_info_get without checking return value = (as is > done elsewhere 110 out of 117 times). You can just say "This patch checks return value for rte_eth_dev_info_get()= in show_macs()." >=20 > Coverity issue: 353629 >=20 No need for this breaking line. Please see other examples for Coverity issu= es. > Fixes: e1d44d0ad623 ("app/testpmd: show MAC addresses added to a port") > Cc: stable@dpdk.org >=20 > Signed-off-by: Kalesh AP > --- > app/test-pmd/config.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) >=20 > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index > 576d5ac..ade26e0 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -4927,10 +4927,15 @@ show_macs(portid_t port_id) > struct rte_ether_addr *addr; > uint32_t i, num_macs =3D 0; > struct rte_eth_dev *dev; > + int ret; >=20 > dev =3D &rte_eth_devices[port_id]; >=20 > - rte_eth_dev_info_get(port_id, &dev_info); > + ret =3D rte_eth_dev_info_get(port_id, &dev_info); > + if (ret !=3D 0) { > + printf("rte_eth_dev_info_get() failed for port %u\n", port_id); > + return; > + } You can use eth_dev_info_get_print_err(). Testpmd uses this function to uni= fy the err print. And only this place needs check, so you don't need to def= ine "ret". Just the following is enough: if (eth_dev_info_get_print_err(port_id, &dev_info)) return; BRs Xiaoyun >=20 > for (i =3D 0; i < dev_info.max_mac_addrs; i++) { > addr =3D &dev->data->mac_addrs[i]; > -- > 2.10.1