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 6AB3CA00C3 for ; Wed, 15 Dec 2021 14:19:00 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5CEA640688; Wed, 15 Dec 2021 14:19:00 +0100 (CET) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 6C0CA40688; Wed, 15 Dec 2021 14:18:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1639574338; x=1671110338; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Pf0KqIHJucDR+TtAn+DnQR11uygkJL5HcMZpFFMH5eY=; b=nzhUJX64kOP/TxCwoeEhfFfsb8reWVTnZ6vUOMWvEQyjARHWgrzK5DrC wMV8NHriU3wGSwTI9OFpmUlltzSc0OIWCaaKMhNqIajq8fT8CKJ/I7vQE UG7vn4Qf0gEFI8TaJlVeSlZTwZjmzcgyXTMhQw4WshNifTZvAn2ypNpPW glRa6MukDvRilAcWtrug8hGQ/9yZjx/pjjGm1WC2NBg4mjGrphw9kPA/i IgQ05of7WYXMKjoP3mEs4AxPyqRcayKXPgBjtdtG8zZPvd7Wr2NQGwAAM iElDdWnP/KminDkjy0QSo1fzysekF72QjFrJux21T3/4gLOMTZZynOF7L A==; X-IronPort-AV: E=McAfee;i="6200,9189,10198"; a="219238640" X-IronPort-AV: E=Sophos;i="5.88,207,1635231600"; d="scan'208";a="219238640" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2021 05:18:57 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,207,1635231600"; d="scan'208";a="545572464" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by orsmga001.jf.intel.com with ESMTP; 15 Dec 2021 05:18:57 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20; Wed, 15 Dec 2021 05:18:56 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.20 via Frontend Transport; Wed, 15 Dec 2021 05:18:56 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.101) 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.2308.20; Wed, 15 Dec 2021 05:18:56 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eYIGKrwlOWRmDNRD7cYOjBss2uTfXDAy4AFZAlbuPOzeYNShhhHeGPWMF+X8TVtPkkOibAMl6tJn1KgA638jflt23naDT+SwI6zjg33L9VRrlEx1QM6nPs51w5+waTTALNBj9VcqDm2LyEOJ35zdR7coAQoYQ9UTUXQtolEAKoCfmxr/JBpBTS1VZJ83ZhZzlBS8BugvpazCbbwEBbAzmAS5I5jHMPI59VC3BdLkMsy0WG6o/PnO/xQ0/wHHBidp0HozSNvL7Yfbyl2CQJstFrXjMRq0l8v4Ac3wCG5IAHZuBhd4bYV66F8aOXXJXwof92/nW4g7mwd/CzdkUcKpGQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NoP9UbLBt3PQQKHBNlctDB9KVqm6vU4xX/TpMkOtkxk=; b=DVb0OCxlegsd9rQxp3jTrBmpZzDHD7d6pOtqLZzGhe+w53vDo4CNqmd1cF+Nmaa6RbF1MxoacdE4l+AJ1jm485fCy5Z8ASbCtI4fkuC3IiI2rYhqz/mGbvjJqIqIbyroACKhPNEaMaW6ZYxGF8VIkgkpttfSTHRJ46DL5ZRNnkmsSZQofWDys1oQ9GvwcFfzrvNQ2yueVQEI3sxa+Sa2xMe94R4sv8eaaEDOJTe2E4QghDNf9DJjWoo/yBx/zD9TNsFh4t67EBqLGWO8fNveDRNQxRvI91XB+bRBX7SC3zYJCjYuqvZLLVgApMpuxzw1FZfCepPdvT/lNmg+P0+RQw== 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 Received: from DM6PR11MB4491.namprd11.prod.outlook.com (2603:10b6:5:204::19) by DM6PR11MB2762.namprd11.prod.outlook.com (2603:10b6:5:c8::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Wed, 15 Dec 2021 13:18:55 +0000 Received: from DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::fc25:a06b:f39b:569a]) by DM6PR11MB4491.namprd11.prod.outlook.com ([fe80::fc25:a06b:f39b:569a%5]) with mapi id 15.20.4801.014; Wed, 15 Dec 2021 13:18:55 +0000 From: "Ananyev, Konstantin" To: Zhihong Wang , "honnappa.nagarahalli@arm.com" , "dev@dpdk.org" CC: "stable@dpdk.org" Subject: RE: [PATCH] ring: fix overflow in memory size calcuation Thread-Topic: [PATCH] ring: fix overflow in memory size calcuation Thread-Index: AQHX8Jr5wRnf34K8iEaPOr0He2Jcg6wzijXw Date: Wed, 15 Dec 2021 13:18:55 +0000 Message-ID: References: <20211214033016.29927-1-wangzhihong.wzh@bytedance.com> In-Reply-To: <20211214033016.29927-1-wangzhihong.wzh@bytedance.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-reaction: no-action dlp-version: 11.6.200.16 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 82dbf524-e5d5-4c07-3cc3-08d9bfcd7257 x-ms-traffictypediagnostic: DM6PR11MB2762:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:304; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: JqHBAa2A59DJVof4LyaCWkMZGJzGj30l3LT7fayPmXHdFa009k+4VMheXk1G4X6JV5eep42m2hZ/v4ce/bXi60RFmh++JYnxm8qQ+lAoX8LO9QfOtqnG6+HPir0fnkklX1BrJQGcIlhHRRkF4/SliQyF+x4hfldr9IIglaW14cykyi1H7eZ7rCA6oJbekLRR5AIXnoUVlydtINN8T6LcLZ60Frt+UbVmirz8f5WTCokBQFZLvXTHd37QNkmm4MeQ4OKPDfWZtJdsN0kcryUyULO3FHZh/+bI+UAkok6L3tRPwU8jqLIxKKQssy7/Xlk57sNQ9uqL/3nVQwDpAniE4AO+xYruJmijGvQr+rKIpX7oPEnFTkcXYYp3sA4imWfL51wckI3IJMaE3n8+iRES9P5jAoh6kjPUjkYDgzyD15e/vgP2S/NYVSGSwzf9F9MpKcliv8TCtL18x90Ms6k2Q3VLjqubo+bCF+Gjd2QrnhjCmKNaxQIMOp07UozjIjXAIfn0L8uGlP/lKE7ZIXxE+4Vhlax4S64Uqwb5g7fjOQLJ0BUReMuZv3CwiXJ5ITtK9QTwrrDGUtJWYEjun66DuPiG5ScbWL+JBrk5xirzB9MIwOls6Hid/xENBKOCVWC/0v16VJHckRDW0ero1n0urLUqUCpmX1LBB406oEiNvm6wzgVYA3tXkGEdqfll/ywVUqWGS+o8Lv13aPcUkvZ68Q== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4491.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(66946007)(4326008)(2906002)(71200400001)(5660300002)(83380400001)(64756008)(52536014)(66556008)(66476007)(66446008)(82960400001)(55016003)(4744005)(186003)(9686003)(8936002)(508600001)(122000001)(38100700002)(316002)(8676002)(6506007)(26005)(86362001)(7696005)(55236004)(33656002)(76116006)(110136005)(38070700005); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?DRXlpuazgpM3oYx0+WQ+48SfrfZmB+YP7ixAjrjZQiP9vn/AFcDdpPctWS2V?= =?us-ascii?Q?aH90zNaZC87FJwzVxjIghbwNBmHm0dMGbH8+YhXMLDJ12ATVKg53oKe8fmBK?= =?us-ascii?Q?WpxvDQS0VhE1nhRceQir1rdZrI7hlod9PS1uAnyB5mEILNyoZZ/Q576lreVy?= =?us-ascii?Q?anOOnSg1AhiQU8wqpgfUWFtXyzLI68wuSKsrKcZn7z/rZRIYCAOtmTcDrLh2?= =?us-ascii?Q?8jQHznRN85dp9sevnk8dSm6OMNutzdKmDLJ3juZy/PSVtB/D44nyss/K5A+T?= =?us-ascii?Q?KHDk1xST5zotOZCWGBUwvC7Vl09EKXhw5zYQaBYzcfF5CLqzdSJPNFfggi2a?= =?us-ascii?Q?gMoRiagR8aconMDY7ToVwO+jsY5BNXDwyflBTwVo4ffnLJDVQGnietAxAK4M?= =?us-ascii?Q?cG3dJQssQ/MsmMDqcUVAzFYaXMNcth4SjNozXgPEWrAsr7OEgONMTzrpPZOJ?= =?us-ascii?Q?O3v6PiM7x8t72B8hhVm8jJFFXvJt180o53n+e0WuvyB/eLtF0htGksr9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l2iYsAVWdgVEMpnAHitEZrsv2pwOITQGsQBlCSBiDh0IsMsPhp7?= =?us-ascii?Q?0GkF35DZ8wG0Lx4/72/+MdSM6E23ocqGMAJt3VyfUBNMePh60WG2kseVxyxq?= =?us-ascii?Q?CQdIBhvshnLju4DDq4XGLeiKu3EJXhSueXmK4ubtqsIBxShF1lO67bFreu2T?= =?us-ascii?Q?+gx4bzvnAjtaU+eCAAasW4/OUmPRYmPojxOLBq6jgAkee0PASv0EIe3TfAZz?= =?us-ascii?Q?btl6um6SM7YqHB2OdcFviQ/oILdJ0Z1y/kYztsmwvJpZ1HgBJAsKqRqxgX7w?= =?us-ascii?Q?Bz3aFQ=3D=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: DM6PR11MB4491.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 82dbf524-e5d5-4c07-3cc3-08d9bfcd7257 X-MS-Exchange-CrossTenant-originalarrivaltime: 15 Dec 2021 13:18:55.6687 (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: dBeYK+ykQaz1cZfcygaSKbIuKcexwdNutVoaQyjFOKn2c5yw1eIoxhTi2CBgAYZSXq6s9DwJDIgzDvu+A/BLoBG/pB+fp0TedAoxqHJldbs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB2762 X-OriginatorOrg: intel.com X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org > Parameters count and esize are both unsigned int, and their product can > legally exceed unsigned int and lead to runtime access violation. >=20 > Fixes: cc4b218790f6 ("ring: support configurable element size") > Cc: stable@dpdk.org >=20 > Signed-off-by: Zhihong Wang > --- > lib/ring/rte_ring.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/lib/ring/rte_ring.c b/lib/ring/rte_ring.c > index f17bd966be..d1b80597af 100644 > --- a/lib/ring/rte_ring.c > +++ b/lib/ring/rte_ring.c > @@ -75,7 +75,7 @@ rte_ring_get_memsize_elem(unsigned int esize, unsigned = int count) > return -EINVAL; > } >=20 > - sz =3D sizeof(struct rte_ring) + count * esize; > + sz =3D sizeof(struct rte_ring) + (ssize_t)count * esize; > sz =3D RTE_ALIGN(sz, RTE_CACHE_LINE_SIZE); > return sz; > } > -- Acked-by: Konstantin Ananyev > 2.11.0