From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C9DC8A034E; Thu, 4 Jun 2020 10:45:55 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C2A441D5D7; Thu, 4 Jun 2020 10:45:54 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2045.outbound.protection.outlook.com [40.107.21.45]) by dpdk.org (Postfix) with ESMTP id EDE851D5C4 for ; Thu, 4 Jun 2020 10:45:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7l4YUndVIcoOep3e7HKQP4u+aX2gSBoQzwtD01ElnsU=; b=xFFgBu2+xpJDMXlqJkeakA2oXAvQYC/lJYE7sUSrwi+X384eTYSUFXnXV2RJNOsDJ+UmJuhhsdkA6QBJlONp69/6jy9vUGAxZ9G8gjFzTxlDYda4O+YXtHds6OMarsc86dE37qha3nCcTZGnj1tt+PFcQ0va7h/Erz23n/IM3zA= Received: from DB6P195CA0006.EURP195.PROD.OUTLOOK.COM (2603:10a6:4:cb::16) by AM6PR08MB3685.eurprd08.prod.outlook.com (2603:10a6:20b:6f::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.21; Thu, 4 Jun 2020 08:45:50 +0000 Received: from DB5EUR03FT013.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:cb:cafe::ab) by DB6P195CA0006.outlook.office365.com (2603:10a6:4:cb::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18 via Frontend Transport; Thu, 4 Jun 2020 08:45:50 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dpdk.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dpdk.org; dmarc=bestguesspass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT013.mail.protection.outlook.com (10.152.20.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3066.18 via Frontend Transport; Thu, 4 Jun 2020 08:45:50 +0000 Received: ("Tessian outbound 952576a3272a:v57"); Thu, 04 Jun 2020 08:45:50 +0000 X-CR-MTA-TID: 64aa7808 Received: from 27535b9a3d84.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id B08EE143-6A80-4D14-A1E4-AB2C8F31D757.1; Thu, 04 Jun 2020 08:45:45 +0000 Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 27535b9a3d84.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Thu, 04 Jun 2020 08:45:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GAigAHAjv4fVSKQ70Qkmk9NKXdZ84bhD5AJCetrq6+FIzZ9b4SzHUwQwqtmAQtHLLcRjEvHsIt+JjDcZ6GDMBPYTjtWJkR2QRHJtyKp6meBo9OOt/5VFaCXnOGl9f+yNEBJQ2kqYVwJmcNAA0L3u+8lTF6Hj7uJRtWtCZ0Fm0dGCGYMdDVI0f7+7Bx+UXsxW2qNU6/5carDKLBU8wSxzaPuhTz4+kM6oY3cJT0DXZsKf+FrPtIsUDQYmFZhluwHUOH6sIpD6VQBIG53CeidX9/bPUtQ/r/TM15MxiWXd/QqwbW0n+DmJeZ7D4Nl2FNFYwkyJ5y5Sx+qsZAUfPCB1vg== 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=7l4YUndVIcoOep3e7HKQP4u+aX2gSBoQzwtD01ElnsU=; b=W4GFNlzkyzEAOpTfDSWeS3f7ob+cNoOrA2cmyXjl2AG6AQUaG+ND1bblH94nRpzZEbeQ90+pPDQItMpGxx7z1mm+Hxwa7TD8KmcnbVa/0s+3KwdJk8+uKZFcpfIELzpULzDVEUvgkwNyGEyxs83mjZRpzckSXAez5V1jegSSz3dDdM2zryy5N/R6upQW6wkXeoG6zMkvP1rME+1/FxLFZpdVKh6Zd0c3JCjqjlOe/6hy9T4Jy35EBJeAve6wEfijLlLO/C9dpTRrNBexRvMoAbfBOl5Gtgd5fmjP4wb6wSlmwy7ld0GGja3iSHgGdu72/Om2ejZS2NLYrgS+dnUNuw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=7l4YUndVIcoOep3e7HKQP4u+aX2gSBoQzwtD01ElnsU=; b=xFFgBu2+xpJDMXlqJkeakA2oXAvQYC/lJYE7sUSrwi+X384eTYSUFXnXV2RJNOsDJ+UmJuhhsdkA6QBJlONp69/6jy9vUGAxZ9G8gjFzTxlDYda4O+YXtHds6OMarsc86dE37qha3nCcTZGnj1tt+PFcQ0va7h/Erz23n/IM3zA= Received: from VE1PR08MB4640.eurprd08.prod.outlook.com (2603:10a6:802:b2::11) by VE1PR08MB5214.eurprd08.prod.outlook.com (2603:10a6:803:111::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3045.21; Thu, 4 Jun 2020 08:45:43 +0000 Received: from VE1PR08MB4640.eurprd08.prod.outlook.com ([fe80::c2e:9ccb:a690:6863]) by VE1PR08MB4640.eurprd08.prod.outlook.com ([fe80::c2e:9ccb:a690:6863%6]) with mapi id 15.20.3066.019; Thu, 4 Jun 2020 08:45:43 +0000 From: Phil Yang To: "Wei Hu (Xavier)" , "dev@dpdk.org" CC: nd , nd Thread-Topic: [dpdk-dev] [PATCH] app/testpmd: fix passing negative parameter to strerror Thread-Index: AQHWOjjAV5n3HU+I+ECSX+JjEAnGG6jIHaIg Date: Thu, 4 Jun 2020 08:45:43 +0000 Message-ID: References: <1591251737-64598-1-git-send-email-xavier.huwei@huawei.com> In-Reply-To: <1591251737-64598-1-git-send-email-xavier.huwei@huawei.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 9a0e74c4-2457-4b21-b2e1-452b40ae4868.0 x-checkrecipientchecked: true Authentication-Results-Original: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=arm.com; x-originating-ip: [203.126.0.111] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: e881f2e8-fa28-45a0-2a02-08d80863af0a x-ms-traffictypediagnostic: VE1PR08MB5214:|AM6PR08MB3685: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:131;OLM:131; x-forefront-prvs: 04244E0DC5 X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 9NveuUz5oE7fHe/DRk9Va3TI3emngoIV/fBTPqqxZOiuKT4dN7ffnR/kcaRGiq2GN27nIlq0RxEYvgAagnVRxVYfNpjtcPFbshFzO2TB2fmigzy5MAUWs3inAIZ0lM/V11Zcq75OTg/Yg8Yf7MX3/iHyZk+N5jbiBMArucsNoxLEXRXdHD7QiZqhVdYR8xMqnsSR+mJaBtvC+E/uqLsijQFINK5L+5fCkGSR57xZnWOwXmC5hRu2gOy2Cg6+jB+5dXhml8kAy9hY5iGs4PQPFJanMO8IixJIVY2Qputl3N45/lGsadRAXeGAGD+NeIIqKgtcBRzzTZ/lVKhl7afGNQ== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR08MB4640.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(396003)(376002)(366004)(346002)(39860400002)(6506007)(54906003)(110136005)(9686003)(55016002)(8936002)(316002)(52536014)(66556008)(83380400001)(186003)(66476007)(478600001)(76116006)(2906002)(66446008)(5660300002)(66946007)(64756008)(7696005)(71200400001)(33656002)(26005)(86362001)(53546011)(4326008); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: Fk2pxZp/780bqRWGTZlhvAec5NYrv95dIEO7x2Q5Xhm/E/Rwk/V/LjsOV9sJ491kVgVBTQ2t2Ih0x7go8wXet0XhMHJpKHuhnEDl6gLzWb0kLITQf+PyD204ezc4PYHY1k0lAA+YXHb+UZ8GBHN08x4ADZ3K5LmQEQBqsMmCfA6PLHx/0nxRfgRVoL+dPHA+H4JALV5/XAm78uREEww49oZqbv5xy3QpA52ikH+xLCpJ5RCANRFMJ261uAI1CGomdOP0ipGk23HLhuqtNmCWTXZ6Cr0DB1khUHdu9D4By0FyWedRb6IiWw1lfVX/PkZo0SXDLzK9x06FZgCfocGP+tU267sAdJR1HzhsxuAnRGzcKuOf6W3ipVMb6gKkBBzmYaIunZjEgIGmpYwUU8M1W+4lz1e5VJnE7+Cr7evoIXHjYr2gCpl07lyWUt7Fac7qJInFwkjpNJ4TGBvm0RrhXl0WyEucniLM0h8gpY0KEa4= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB5214 Original-Authentication-Results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT013.eop-EUR03.prod.protection.outlook.com X-Forefront-Antispam-Report: CIP:63.35.35.123; CTRY:IE; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:64aa7808-outbound-1.mta.getcheckrecipient.com; PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com; CAT:NONE; SFTY:; SFS:(4636009)(396003)(39860400002)(136003)(346002)(376002)(46966005)(356005)(2906002)(53546011)(110136005)(336012)(186003)(316002)(9686003)(4326008)(26005)(55016002)(8936002)(82740400003)(70206006)(70586007)(6506007)(81166007)(86362001)(52536014)(47076004)(7696005)(54906003)(33656002)(83380400001)(5660300002)(82310400002)(478600001); DIR:OUT; SFP:1101; X-MS-Office365-Filtering-Correlation-Id-Prvs: 8b5821f7-632d-41e1-aa5e-08d80863aabd X-Forefront-PRVS: 04244E0DC5 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VK4X0J+f/Q086Neqiba0scslmCv4a565N6fMU2PbmSIgr9CKTs1UFQvlmYx//qZj47z2AfGxry8hYJ59bXonMaf0dftpUD1GjLquwiUL1WirNn4YHpMt2pEDiBQ77zDbQyg5Fx7PiDYm9UBDe1f38KMrF4zwGIAStG7DJCfYIp0+HF+o5XMN/PUXhinW7HsCCqnJtcujlNkOb1/C6kwIWL56fN6WFxcTqln+PkPcnNT9ZeJexBoVRST/7FTfhNvvBpOIneZkvdvkX1ziH5014cCxdAsRfXarsYJPREhLFznB8Z6Bomx5wZ/2orD0chzZ76sptaCZhV63pD2CSlpAAcfYlUBDqYPucjRt0KPHIFFbF/NbbJ3oVjQOwTL69abzESdZhs/OfzqFLYDABo8Elg== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2020 08:45:50.4328 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e881f2e8-fa28-45a0-2a02-08d80863af0a X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d; Ip=[63.35.35.123]; Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3685 Subject: Re: [dpdk-dev] [PATCH] app/testpmd: fix passing negative parameter to strerror 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" > -----Original Message----- > From: dev On Behalf Of Wei Hu (Xavier) > Sent: Thursday, June 4, 2020 2:22 PM > To: dev@dpdk.org > Cc: xavier.huwei@huawei.com > Subject: [dpdk-dev] [PATCH] app/testpmd: fix passing negative parameter t= o > strerror >=20 > Currently, there are coverity defect warnings as blow: > Coverity issue: > In nic_stats_clear function: > CID 290021 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS) > 5. negative_returns: ret is passed to a parameter that cannot be > negative. >=20 > CID 289974 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS) > 6. negative_returns: ret is passed to a parameter that cannot be > negative. >=20 > In nic_xstats_clear function: > CID 289985 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS) > 5. negative_returns: ret is passed to a parameter that cannot be > negative. >=20 > CID 289850 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS) > 6. negative_returns: ret is passed to a parameter that cannot be > negative. >=20 > This patch fixes them by passing '-ret' to the function strerror() when r= et > is negative. >=20 > Fixes: af75078fece3 ("first public release") It was the commit da328f7f115a ("ethdev: change xstats reset function to re= turn int") introduced this defect in nic_xstats_clear() function. Not the "first public release" commit. :) The patch looks good to me. Thanks, Phil > Fixes: 9eb974221f44 ("app/testpmd: fix statistics after reset") > Cc: stable@dpdk.org >=20 > Signed-off-by: Wei Hu (Xavier) > --- > app/test-pmd/config.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) >=20 > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index 5381207..356d0d2 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -244,14 +244,14 @@ nic_stats_clear(portid_t port_id) > ret =3D rte_eth_stats_reset(port_id); > if (ret !=3D 0) { > printf("%s: Error: failed to reset stats (port %u): %s", > - __func__, port_id, strerror(ret)); > + __func__, port_id, strerror(-ret)); > return; > } >=20 > ret =3D rte_eth_stats_get(port_id, &ports[port_id].stats); > if (ret !=3D 0) { > printf("%s: Error: failed to get stats (port %u): %s", > - __func__, port_id, strerror(ret)); > + __func__, port_id, strerror(-ret)); > return; > } > printf("\n NIC statistics for port %d cleared\n", port_id); > @@ -333,14 +333,14 @@ nic_xstats_clear(portid_t port_id) > ret =3D rte_eth_xstats_reset(port_id); > if (ret !=3D 0) { > printf("%s: Error: failed to reset xstats (port %u): %s", > - __func__, port_id, strerror(ret)); > + __func__, port_id, strerror(-ret)); > return; > } >=20 > ret =3D rte_eth_stats_get(port_id, &ports[port_id].stats); > if (ret !=3D 0) { > printf("%s: Error: failed to get stats (port %u): %s", > - __func__, port_id, strerror(ret)); > + __func__, port_id, strerror(-ret)); > return; > } > } > -- > 2.7.4