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 CBC59A0A02; Fri, 23 Apr 2021 04:00:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 978E341CF8; Fri, 23 Apr 2021 04:00:58 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 376054014F; Fri, 23 Apr 2021 04:00:56 +0200 (CEST) IronPort-SDR: GrVtgEiY2rHRY9jYkClCKoh68B9VQhOczCuKG82Db3IFKm3x6t0PgmfRSjYm9LOn9FDkpgqke5 4ADTtIupA3xg== X-IronPort-AV: E=McAfee;i="6200,9189,9962"; a="176126019" X-IronPort-AV: E=Sophos;i="5.82,244,1613462400"; d="scan'208";a="176126019" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Apr 2021 19:00:55 -0700 IronPort-SDR: Z4l9g6oncii6V4smazh59tJY49KHMUwC62gqLWWe1nfVjbmLtqIIhSHQeL3ukJ3DqIHo+PPQX8 2OthTQ9QX5jg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,244,1613462400"; d="scan'208";a="617852818" Received: from orsmsx604.amr.corp.intel.com ([10.22.229.17]) by fmsmga005.fm.intel.com with ESMTP; 22 Apr 2021 19:00:54 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 22 Apr 2021 19:00:53 -0700 Received: from orsmsx607.amr.corp.intel.com (10.22.229.20) by ORSMSX608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 22 Apr 2021 19:00:53 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx607.amr.corp.intel.com (10.22.229.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Thu, 22 Apr 2021 19:00:53 -0700 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (104.47.56.45) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Thu, 22 Apr 2021 19:00:49 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YzVpHfOAD/6g9Vz+PX2lwkA6eTn/K48RunwkQEsO+vCrFMdkfPhhjy6vtyctodJPPmGV0SqiGeCjk66wlF4UE2lipZx2FUSc/rZUeRH8Odwp2nH5h+Ur8RsntHbas0gfsIbTrX4Dea7dsbIFuGi0w388DKeZVBvOwqVzXx3KBWl53qcJzOtMGKbVZDSPU66pwuQNufhf0RZPjKedB0PKpv4pVx3g9YQmPh1YZ2vlMESfSWLY39kISireTD36sLJkvqdYIT+bP5GZIuXJWgZnhoM3saamgI+GDIg963CcPtco2JC6kaARykgTKyDtX9Z986v1FUZGQY9P2pnAOJpAjw== 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=F4m+WUAlhSKWP/f0zZIqmy/mcm0fDRmPC9zVqG54XRM=; b=VXxJ9uUk7H/SctD1dolIb+7Bptg1zklWqhNxhhpVI23Yo0/LWLOdKawvxIvaXVQlubnRZGtjfz+HboRL35cNwgVo0R+fbD37/GAgol7cA9UQPzXXcfkJCnVoP0US00Jc7mpF+dgtO7TtSACjAtPJZrGNE+aQEeuF6ozuO5tzX/XEIeE59p6KX6Ao3yOyoaBeIt/6491qk8dpeuTYBopQPqlVuttpnqzxbTpHxP8wVUMuuuN1UohZHcn15ZtCsUQYpnZT9gE6zLc9lAPfPwsz8EawIyHWW921XgnavMCEQN2u0D9CXWD31CD9H3D6hvc99C6/owzYV1czK5bkPu1kew== 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=F4m+WUAlhSKWP/f0zZIqmy/mcm0fDRmPC9zVqG54XRM=; b=d/KfKZ6s4hG8tz9VSY8bbFm5s+IA5LVUCSn8VTBK1MAJFdO8VE3F6h97+BRao0y5ejvL+sT7AEjZkflheonA1oaysO2z6EWVqjIhJqJT0zB/xOEGsrOYQsqi+daAjSHWbNCnep2kB5mlCtOswvOVt5hwkfJCmW1+YKldLQQ4Zxw= Received: from MN2PR11MB3807.namprd11.prod.outlook.com (2603:10b6:208:f0::24) by MN2PR11MB3647.namprd11.prod.outlook.com (2603:10b6:208:ec::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.21; Fri, 23 Apr 2021 02:00:27 +0000 Received: from MN2PR11MB3807.namprd11.prod.outlook.com ([fe80::e554:7a73:44fd:37b7]) by MN2PR11MB3807.namprd11.prod.outlook.com ([fe80::e554:7a73:44fd:37b7%6]) with mapi id 15.20.4065.020; Fri, 23 Apr 2021 02:00:27 +0000 From: "Xing, Beilei" To: "Yigit, Ferruh" , Igor Russkikh , Pavel Belous , Somalapuram Amaranath , Ajit Khaparde , Somnath Kotur , Hemant Agrawal , Sachin Saxena , "Guo, Jia" , "Wang, Haiyue" , "Daley, John" , Hyong Youb Kim , "Min Hu (Connor)" , Yisen Zhuang , Lijun Ou , "Yang, Qiming" , "Zhang, Qi Z" , Andrew Boyer , Jerin Jacob , Nithin Dabilpuram , Kiran Kumar K , "Rasesh Mody" , Devendra Singh Rawat , Andrew Rybchenko , Jiawen Wu , Jian Wang , "Thomas Monjalon" , Selwin Sebastian , Remy Horton , Chunsong Feng , Huisong Li , Hao Chen , "Wei Hu (Xavier)" , "Wu, Jingjing" , "Lu, Wenzhuo" , "Li, Xiaoyun" , "Zhang, AlvinX" , Shannon Nelson , Alfredo Cardigliano , "Vamsi Attunuru" , Yash Sharma , "Ivan Malov" , Andrew Lee CC: "dev@dpdk.org" , "stable@dpdk.org" Thread-Topic: [PATCH] drivers/net: fix FW version get Thread-Index: AQHXNspkC73+MzvDpUWG3UZ+9mwQvKrBWrxg Date: Fri, 23 Apr 2021 02:00:27 +0000 Message-ID: References: <20210421162058.1352960-1-ferruh.yigit@intel.com> In-Reply-To: <20210421162058.1352960-1-ferruh.yigit@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.5.1.3 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.218] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: f6577175-6026-4be9-39da-08d905fb90eb x-ms-traffictypediagnostic: MN2PR11MB3647: 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:4303; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: i83qGpZGUf6WLSZkghiwXeoliteeypKRL+yoyATnKxUC4iLODLfkv+7oMiITh2ZvSQw+MJdlMtkAnspN101fyJR7/NzeAbnPwxvjs6L14B5pw8I2LOc/blopSRbzclL3UER44XJwVQjPydlYfvUKZ9TcPYspICZqQjMcGXjHHVbBQwVRmAvovmwkwqacU3pcPpZE2JhpJ/ZYY5I+HNIaxytIVJUkXAuw9dJ11HxBJ9SI5QZWLfW+cv+NsGORReGtR3LrBjMdeu6PD3ZEQPg51DfmY5L1rC6/IE13KaZcPFfv7DqafAL51nOQ7uHcS+RI3v54OjevbDlzhT50FlBVKhJMFoV4vFgQxKsoPODpCZUJYtC2lSBQ/aMf/OMAq3G2U8VW8NNzzxcWT/ciYcS2MUpSF2tZ4XOO8Z3nFAL4Xz1mnLmL5BP2Zrf/ALHICUlLd0wZIgNUnHlawZhrt6Z2PTrUvhPwhSWHh9BXJbPSi8Yu4HO2tKmgUI1YB8WOodaIJOcX30wTgEfookQcKdaziRESZScgzXbW8SGzOCy3a3A9nbXYQ7MDII3B5iBUzMtyO/1FIZ7+Gt3JpfMTQU0LXtYjcSA9lserCGxAOdbI/MLtxCHjFVgOywXvcXY2J6KgW+GYMYCXErjaKAih285Ogg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN2PR11MB3807.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(136003)(346002)(39860400002)(366004)(396003)(6506007)(7696005)(1191002)(7416002)(9686003)(2906002)(7406005)(66446008)(316002)(66556008)(64756008)(5660300002)(66476007)(186003)(55016002)(66946007)(110136005)(478600001)(86362001)(8676002)(53546011)(38100700002)(52536014)(921005)(4326008)(122000001)(54906003)(8936002)(33656002)(71200400001)(83380400001)(26005)(76116006); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?JZIlMaDOsJLPJx9UFzgnCWmA/lMnm9JGpQVJhPyjrXTrKR0P71bELj38yw3e?= =?us-ascii?Q?UMlUXRkwnQ4o95qUi0IIlbtyiMv/8LavGYmrm0D50L2IqrZ6CA8WlVbBsjTA?= =?us-ascii?Q?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j916k1j7F6Tf0RsX?= =?us-ascii?Q?q/xn9C5Xw8sk7x0BSNYN7gaocEIRhtj0u9bYl8d/XNnCcU2rTPTf8qoNE3/5?= =?us-ascii?Q?ppNOrzEX+YW8ziiPJWE33S8egepmQLKO0JB2X7oHfzCNwyDSRtsOcMz+dFEP?= =?us-ascii?Q?tltVN2/QpRcgy9pnHcjq53rRQ4ebcOFtdC4Up4XrTgpwsAGdEDJN6NrWZA7O?= =?us-ascii?Q?Fxs3icBXJquSKKGd1aQniqZu4SWQ7AqylZhABMPJQCqpB3/LtQgpB4E2t2C7?= =?us-ascii?Q?bHeQgeC8EjNDsyrHERxz/n1kjgsvTvjgCZk6NHhwMxfTgj2KWTmZWsS8j7Ll?= =?us-ascii?Q?ufOA3OOb5vB4oxedU5agwvgG?= 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: MN2PR11MB3807.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: f6577175-6026-4be9-39da-08d905fb90eb X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Apr 2021 02:00:27.3652 (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: nbY+YfWHE2ilZo6spXF1RYT+HFL2z0MhTqUmwTVIuBiWYOADLoQILGiySOZgDjP5//bJwEagfYP0MFMmn+V+JQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR11MB3647 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH] drivers/net: fix FW version get 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" > -----Original Message----- > From: Yigit, Ferruh > Sent: Thursday, April 22, 2021 12:21 AM > To: Igor Russkikh ; Pavel Belous > ; Somalapuram Amaranath > ; Ajit Khaparde ; > Somnath Kotur ; Hemant Agrawal > ; Sachin Saxena ; > Guo, Jia ; Wang, Haiyue ; > Daley, John ; Hyong Youb Kim ; > Min Hu (Connor) ; Yisen Zhuang > ; Lijun Ou ; Xing, Beilei > ; Yang, Qiming ; Zhang, Qi = Z > ; Andrew Boyer ; Jerin Jacob > ; Nithin Dabilpuram ; > Kiran Kumar K ; Rasesh Mody > ; Devendra Singh Rawat ; > Andrew Rybchenko ; Jiawen Wu > ; Jian Wang ; > Thomas Monjalon ; Selwin Sebastian > ; Remy Horton ; > Chunsong Feng ; Huisong Li > ; Hao Chen ; Wei Hu > (Xavier) ; Wu, Jingjing ; > Lu, Wenzhuo ; Li, Xiaoyun ; > Zhang, AlvinX ; Shannon Nelson > ; Alfredo Cardigliano ; > Vamsi Attunuru ; Yash Sharma > ; Ivan Malov ; Andrew > Lee > Cc: Yigit, Ferruh ; dev@dpdk.org; stable@dpdk.org > Subject: [PATCH] drivers/net: fix FW version get >=20 > Fixes a few different things: > * Remove 'fw_version' NULL checks, it is allowed if the 'fw_size' is > zero, 'fw_version' being NULL but 'fw_size' not zero condition checked > in ethdev layer > * Be sure required buffer size is returned if provided one is not big > enough, instead of returning success (0) > * Document in doxygen comment the '-EINVAL' is a valid return type > * Take into account that 'snprintf' can return negative value > * Cast length to 'size_t' to compare it with 'fw_size' >=20 > Fixes: bb42aa9ffe4e ("net/atlantic: configure device start/stop") > Fixes: ff70acdf4299 ("net/axgbe: support reading FW version") > Fixes: e2652b0a20a0 ("net/bnxt: support get FW version") > Fixes: cf0fab1d2ca5 ("net/dpaa: support firmware version get API") > Fixes: 748eccb97cdc ("net/dpaa2: add support for firmware version get") > Fixes: b883c0644a24 ("net/e1000: add firmware version get") > Fixes: 293430677e9c ("net/enic: add handler to return firmware version") > Fixes: 1f5ca0b460cd ("net/hns3: support some device operations") > Fixes: bd5b86732bc7 ("net/hns3: modify format for firmware version") > Fixes: ed0dfdd0e976 ("net/i40e: add firmware version get") > Fixes: e31cb9a36298 ("net/ice: support FW version getting") > Fixes: 4f09bc55ac3d ("net/igc: implement device base operations") > Fixes: eec10fb0ce6b ("net/ionic: support FW version") > Fixes: 8b0b56574269 ("net/ixgbe: add firmware version get") > Fixes: 4d9f5b8adc02 ("net/octeontx2: add FW version get operation") > Fixes: f97b56f9f12e ("net/qede: support FW version query") > Fixes: 83fef46a22b2 ("net/sfc: add callback to retrieve FW version") > Fixes: bc84ac0fadef ("net/txgbe: support getting FW version") > Fixes: 21913471202f ("ethdev: add firmware version get") > Cc: stable@dpdk.org >=20 > Signed-off-by: Ferruh Yigit > --- <...> > diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethde= v.c > index e6206a7e5100..66d23d698ea0 100644 > --- a/drivers/net/i40e/i40e_ethdev.c > +++ b/drivers/net/i40e/i40e_ethdev.c > @@ -3687,9 +3687,11 @@ i40e_fw_version_get(struct rte_eth_dev *dev, > char *fw_version, size_t fw_size) > ((hw->nvm.version >> 4) & 0xff), > (hw->nvm.version & 0xf), hw->nvm.eetrack, > ver, build, patch); > + if (ret < 0) > + return -EINVAL; >=20 > ret +=3D 1; /* add the size of '\0' */ > - if (fw_size < (u32)ret) > + if (fw_size < (size_t)ret) > return ret; > else > return 0; For i40e, Acked-by: Beilei Xing