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 90640A00BE; Tue, 7 Jul 2020 15:37:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B8FD01DC2D; Tue, 7 Jul 2020 15:37:52 +0200 (CEST) Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-eopbgr140055.outbound.protection.outlook.com [40.107.14.55]) by dpdk.org (Postfix) with ESMTP id EDDB61DC21 for ; Tue, 7 Jul 2020 15:37:50 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CkcD9xuHbDXouDQrCHxTScYldR7yIEbUIZo1k83XHgktQIgkV0AAcpGq4+NUga7XBMbyAbBcPYFuO+bCIIHjn8mMe+rTM7Sdlc3laXzpLEQRdsrd5WKvdymz1kaRcQ3xlLesuIH7zhB1zhMny5F4Ef6dNKnxj3LhRDhM1rzXa0uBtnFlak6aUvqKodiTtD0VdbhJH/kn2c+eBCtpJWtiIeH0qG/jJjZru57/+oiMNODPKtoCX8n3ICad/C5DuMzsR29xOXaMUe8HdEe0BIDQJUJc7ZivpFY0fPXm+TCxTV9btrULw9ttZ2q2AwQkW+A6ZQtoYjn7A3FsUXCMgc1LKA== 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=ddj323U74acJjUHsOlEjKIwT/6h/FArbepgH4krcXSE=; b=cF6qQci0vljkHOvJleyRWKJWO6hfA7avavuixpbEL8+rQw8QyR968/OnwH3mCZJaGPCCWzXpX4fadLfhF+OerCy+4dBkUZSANlbYb3Ph83DwajWpJol533mgY1jouWfbIn2fAfAFvrG4aT1/iPMJxy1CuFFDsV+g5Yb21mYyJB2NbPXBH6UURjqh/B4jbmubBnWsABFGGDNrk3I0WtRglJArj1nKYM/siIAt2CyME4S2qBC/hP052unnXUkxYmrC2JNn160rWX/ufXoS+V5cKUywTCfma1gArhTcsNayw8+QCHMnMprWZmp3Y5aVf+LvKmEoxPPCN6yvzd5iT8UsrA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none 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=ddj323U74acJjUHsOlEjKIwT/6h/FArbepgH4krcXSE=; b=MbZe3RbU89PcmHdNr73glXxCdXMt07mFSRmmcW03BI9lRgH9fZJxgMPv3bUQsphZdicoYdiuj2fB9gm+BH/YyNxzdJtnTC96IOYEztR1vFU0RMY4Gqn0hMwmvYedwDyaULy8SjWMHYB7R8iqd16ilafqh/WJlZdgQdx2ilmqFFY= Received: from AM4PR05MB3265.eurprd05.prod.outlook.com (2603:10a6:205:8::26) by AM0PR05MB5795.eurprd05.prod.outlook.com (2603:10a6:208:111::26) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.27; Tue, 7 Jul 2020 13:37:47 +0000 Received: from AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::194e:dc46:7543:50ed]) by AM4PR05MB3265.eurprd05.prod.outlook.com ([fe80::194e:dc46:7543:50ed%2]) with mapi id 15.20.3153.029; Tue, 7 Jul 2020 13:37:47 +0000 From: Slava Ovsiienko To: "Wei Hu (Xavier)" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v6 1/2] ethdev: fix data room size verification in Rx queue setup Thread-Index: AQHWU2RDh7IL6l3NYEyw/TFcqvNV1Kj8IK9A Date: Tue, 7 Jul 2020 13:37:47 +0000 Message-ID: References: <1594019191-54524-1-git-send-email-xavier.huwei@huawei.com> <1594019191-54524-2-git-send-email-xavier.huwei@huawei.com> In-Reply-To: <1594019191-54524-2-git-send-email-xavier.huwei@huawei.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: huawei.com; dkim=none (message not signed) header.d=none;huawei.com; dmarc=none action=none header.from=mellanox.com; x-originating-ip: [95.164.10.10] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 3fe52ae1-2686-4203-1b2c-08d8227aefb4 x-ms-traffictypediagnostic: AM0PR05MB5795: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:7219; x-forefront-prvs: 0457F11EAF x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: bxAG19/QTGM/ev6TlcZzbc4aHRQI6OdaLBL4yteABgp+1t1wifcjgWAilkdVuj274YVwHaOW//ANC76/wOXaTK1RNV8X35f5Py7BmPGw34YbaqPb8+p94n/EPNPQEHoq1odMf3gNrWaJG36qYs1r9bHCMkPD+FpxTAxETcwt1K+HaV8VUe+KMuIUC1ElUhITVIH/ThFCtcjjpoLxPbzsDQw+tWzMiFO196v5T39F1QBGhhmlzYgCUMkFUsVI/dDNJA/XdHigq/eWb02AH9iXER3YYVy0H9GxVKF3Li20LZ2uF5oUtpJUWq7X5ZLWK+v7s+cPriJF0u8+6PkD4G+yXg== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM4PR05MB3265.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(366004)(66946007)(76116006)(66476007)(66556008)(15650500001)(64756008)(55016002)(83380400001)(66446008)(33656002)(53546011)(498600001)(86362001)(71200400001)(8936002)(110136005)(5660300002)(7696005)(26005)(6506007)(9686003)(2906002)(186003)(52536014); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata: R5KYL5c1i33Mjhy8iPVMN5reZA8IoWYbS/ibBFzPsKGmqboXa1i2tpeylaVFzJhdhi3tovbB/Fo4Co99en2djWf7cFes516mnML4Hm6/QKtw7clQt9ckWSWy8LL8iN47ehUWROKbNvpH42DLibKTFDG4yFY54zTQxMsz2DUgTzQlEFOdG3zYHcWGB1uoC/GHrf7YxCxXhV37SlrTV5B7x2Y2DwYFeyBARyJJHGfBsbiE2fjqh18lI7Snp99X67kpHxer5cWgqwaQ9Kq+1auGQpyY3d6if91N4a7oLNZ8FEK/1c6hJHofIkxTWWeeeaBOVftEzsMMdHBmBOHakNsbhLl3kZvRWcAB9xlJV+YG2WUijhll7bxjs5OGtEXlFDQ+BFuaap+4CgqNNcVRdXBqXt2YYzSj39syjaiSJoSDbTBYqEfYRGhW/MeEJ50CifiQs8pZBaQDvvz4sCfxzt7LbEZJ30AOq6yyc/6OrAwZiXQ= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM4PR05MB3265.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3fe52ae1-2686-4203-1b2c-08d8227aefb4 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jul 2020 13:37:47.4678 (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-CrossTenant-userprincipalname: uwPu4pLV9qBDOfuhCB4fzWU7TSJUyLyW03ZJGJ8YhIWw7kQbBPVOmeJkbc69wDDl1pil470NZxYFs1CPEV2a1TsLPlGvIAOpwaBM6FpxN1Y= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR05MB5795 Subject: Re: [dpdk-dev] [PATCH v6 1/2] ethdev: fix data room size verification in Rx queue setup 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" Acked-by: Viacheslav Ovsiienko > -----Original Message----- > From: dev On Behalf Of Wei Hu (Xavier) > Sent: Monday, July 6, 2020 10:07 > To: dev@dpdk.org > Cc: xavier.huwei@huawei.com > Subject: [dpdk-dev] [PATCH v6 1/2] ethdev: fix data room size verificatio= n in > Rx queue setup >=20 > In the rte_eth_rx_queue_setup API function, the local variable named > mbp_buf_size, which is the data room size of the input parameter mp, is > checked to guarantee that each memory chunck used for net device in the > mbuf is bigger than the min_rx_bufsize. But if mbp_buf_size is less than > RTE_PKTMBUF_HEADROOM, the value of the following statement will be a > large number since the mbp_buf_size is a unsigned value. > mbp_buf_size - RTE_PKTMBUF_HEADROOM > As a result, it will cause a segment fault in this situation. >=20 > This patch fixes it by modify the check condition to guarantee that the l= ocal > varibale named mbp_buf_size is bigger than RTE_PKTMBUF_HEADROOM. >=20 > Fixes: af75078fece3 ("first public release") > Cc: stable@dpdk.org >=20 > Signed-off-by: Chengchang Tang > Signed-off-by: Wei Hu (Xavier) > Reviewed-by: Andrew Rybchenko > Acked-by: Sachin Saxena > --- > v2 -> v6: No change. > v1 -> v2: Simplify the check condition of mbp_buf_size according to > Andrew Rybchenko's comment. > --- > lib/librte_ethdev/rte_ethdev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethde= v.c > index d06b7f9..50c3f18 100644 > --- a/lib/librte_ethdev/rte_ethdev.c > +++ b/lib/librte_ethdev/rte_ethdev.c > @@ -1820,7 +1820,7 @@ rte_eth_rx_queue_setup(uint16_t port_id, > uint16_t rx_queue_id, > } > mbp_buf_size =3D rte_pktmbuf_data_room_size(mp); >=20 > - if ((mbp_buf_size - RTE_PKTMBUF_HEADROOM) < > dev_info.min_rx_bufsize) { > + if (mbp_buf_size < dev_info.min_rx_bufsize + > RTE_PKTMBUF_HEADROOM) { > RTE_ETHDEV_LOG(ERR, > "%s mbuf_data_room_size %d < %d > (RTE_PKTMBUF_HEADROOM=3D%d + min_rx_bufsize(dev)=3D%d)\n", > mp->name, (int)mbp_buf_size, > -- > 2.7.4