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 B4109A0547; Wed, 21 Apr 2021 05:33:12 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 44DE6418DB; Wed, 21 Apr 2021 05:33:12 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id E004D418AA for ; Wed, 21 Apr 2021 05:33:10 +0200 (CEST) IronPort-SDR: hMlO+aYZaCrZ/AMFpiBBXs7AgUeDLM5Sz7sEeTtHC6TMKbNj5bEoXHnvRipYnraAFHyK5AF6EM UXhsSGokn3DA== X-IronPort-AV: E=McAfee;i="6200,9189,9960"; a="256946345" X-IronPort-AV: E=Sophos;i="5.82,238,1613462400"; d="scan'208";a="256946345" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2021 20:33:09 -0700 IronPort-SDR: yOFUTWU87Xxc2fZ2m4doMxNXJmuXcJ/3dTFnV7ZMqc5Ax1iT6/w1MfxpFmDg5ppLc7+Wan7ylA Acnyi9jIKSKg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,238,1613462400"; d="scan'208";a="452808709" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by FMSMGA003.fm.intel.com with ESMTP; 20 Apr 2021 20:33:09 -0700 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx606.amr.corp.intel.com (10.18.126.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Tue, 20 Apr 2021 20:33:09 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Tue, 20 Apr 2021 20:33:09 -0700 Received: from NAM04-CO1-obe.outbound.protection.outlook.com (104.47.45.50) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2106.2; Tue, 20 Apr 2021 20:33:07 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LNX0ztplVUgxrJqJvNb4h2rGBHKp9pQ9Fr6f3EFGkqd/5Y9RfhD79N3N4T4CYU/vgTSTNM2WItZY380H1tWgRB0ivhTapP6pCERUKgYopFdXs1XAlj+KJ1yjjvCOqMMqhHB9FgH/VYcnccM8mq74omh5ZrmQ+KJgGOxIrofcsB9zTw/v8PV8Q+2WCnFp3nzXaMhSJF8ZSTZ4buZnaSsYT+hrK3pfaF9vfg8j4jA29Kh1xuJ+q9IxmlCJNGU/0RuHHxJ41heozNAvNGuXCHRvGOyPnXkuXRDK7OFfkG/7JsdOX6hXCw1U6Gux48bmMm8v2roPmA0uodMXVTQr0I7XDQ== 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=Nx8Ugn788LXU7A9wVXNEgNvlz725RsXo0m54XArNHxY=; b=COVzCdJLIWRO56/XWz1YUuh2ACDeDvHjksAgN7MvFXaLPZ+FSR9lX7Kzd4i79mKZCveJ4qE/G0iA98SLycl6I4+pucPEg4FAfu3STF2vWPzOIyqWd8pVxYQl7SQyBbXNO5xrsKvUoypd/D3AJn5ULH57ES0OYtBjRRNiUz08q0NyS1f5fOpSBArk6Q9cJir8P2hBAyq/tLCjC2JCDWR0ackrsTFtLvLGQepnBkKmkra/j2qwsoaBzAJ1NC2UYxMdQDVGqb5D/MdQVQ2KqbeMJPfCUdQ4yUpiglKurkbJI+jKJh/NrrD/O1fj6J9qz2uCHtGWweHHvFQk3p/vv1AOhQ== 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=Nx8Ugn788LXU7A9wVXNEgNvlz725RsXo0m54XArNHxY=; b=R2f4iJPNfBybAsTsPrXteKurlAVm8LMqNP7soeNBEgOd7hpqgW9ceGusBtlsipX0EJCNjN+kYkir1AUrZSf1Q/KZPS95ZTIteeYKJ0GKwG7WwGpmqOD3FJqlYlEUCdx1C07c2rP2c2dpRDQW5QrNkvXUbynDGI54mxyivT8Hgzg= Received: from CH0PR11MB5523.namprd11.prod.outlook.com (2603:10b6:610:d6::15) by CH2PR11MB4391.namprd11.prod.outlook.com (2603:10b6:610:3b::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4042.18; Wed, 21 Apr 2021 03:33:04 +0000 Received: from CH0PR11MB5523.namprd11.prod.outlook.com ([fe80::b1fa:6c6b:1a23:5411]) by CH0PR11MB5523.namprd11.prod.outlook.com ([fe80::b1fa:6c6b:1a23:5411%4]) with mapi id 15.20.4065.020; Wed, 21 Apr 2021 03:33:04 +0000 From: "Li, Xiaoyun" To: "Min Hu (Connor)" , "dev@dpdk.org" CC: "Yigit, Ferruh" , "Wu, Jingjing" Thread-Topic: [PATCH 2/2] raw/ntb: check malloc result Thread-Index: AQHXNlM1rAeWNkY3706ytEc9txWu3qq+UUQw Date: Wed, 21 Apr 2021 03:33:04 +0000 Message-ID: References: <1618970896-37852-1-git-send-email-humin29@huawei.com> <1618970896-37852-3-git-send-email-humin29@huawei.com> In-Reply-To: <1618970896-37852-3-git-send-email-humin29@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=intel.com; x-originating-ip: [192.55.46.54] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5764a1a2-f464-4374-9cb6-08d904762c2a x-ms-traffictypediagnostic: CH2PR11MB4391: 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:2399; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: tbcKYUNwOTPz7GL3XSs5jkQGT6kYUm4MyC0dN9I/OvfrbR0eHzmfoeVYV5wXK0++WbCWGkcXnsxrkvCvOWLq6iGW4HVyvhjHsmP6IVxM+QIv6/nhfvcrn+BJhPb9xg2+GsVBh6NBeDGEqhgIhX0q3/pruLAe+kxly8s4MpRg9X4hSvFgfhj5WWzCihW939BiFDxboDVaweAcdp2Xjz31j82+lGLnRtkS9uXdOkN7AZWycgeSz4DlGYg2tX1f/op+uwOIWdxCM/lxiGf/JB2vy3a2b/AApxxSUkxTXS66fuwdsSCkg4Z4rULkBoye0rr6Rm3fRSDClvSBPeRMhE+NrEeJg73I1cSEoDsGaMTra9lF1gpEYe2A5fA/v88EUsg+3SeKatAcB0Vb96tn1m6BKNlvuH+/cpHrJ1Unt70puLoP+/EjuW9y7FRqhxrkwoLdP+g688w7j7Mx2EKX5j7OS/mnnAJMUdenkqyXYWHUFnT2ayA6narIJKEwoUAZ1qBBFsMD7L7BiV2mrx9gfNq0FopcTLohdxM8qbGtOV620Vx+dxVzV8JX9n8kp2cHxotpCg9js6sfaZLqkp3vN2fmETPU4qUehV+XkM5mCPFYXDA= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH0PR11MB5523.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(136003)(396003)(376002)(346002)(366004)(39860400002)(66476007)(38100700002)(83380400001)(55016002)(9686003)(316002)(66556008)(52536014)(66446008)(64756008)(8936002)(71200400001)(66946007)(76116006)(122000001)(2906002)(110136005)(33656002)(54906003)(8676002)(4326008)(107886003)(26005)(6506007)(53546011)(478600001)(186003)(7696005)(86362001)(5660300002); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?ef6iMqrXedU/Oo9G/7St1JCBGuD35GciVKk5IPZRfFE+0fgaEPz8o+feaI5r?= =?us-ascii?Q?T2xZcr9PQVecuGGmlRxDPenmMu7PX+StCkBo86hNj6iTP7MeDAgTXaxFbeiW?= =?us-ascii?Q?EDPjzbaIAw92FilAM0bZ4HfbfIYNJ2FNuM144Z1lXlWJgr9Z71Uc9/+buOmY?= =?us-ascii?Q?ewCaFdeAfMdt0BvrTeFu7TLCe61f3/2TzEHQuvG5J9GEMzTaK1475eSzn0RB?= =?us-ascii?Q?BcXZJXmrW4eC6AvIDQ5aSinPYgPEpRcDVIvD8QbpK/MrnYEFX4+/82urvsVm?= =?us-ascii?Q?JOSZyuVRLpHP4MfuX0uo0J133+Rt7LywVqXTQpjoFzrhzF+kcdjyDIcJ6737?= =?us-ascii?Q?+Z5tEYmwK6blYAkLYlEipvVTksHLbRAEbgVxNW4iD3fRWyP8pn3FDSdywRhy?= =?us-ascii?Q?K4JjeExXmdq0B+hsi5TSfrQCI9Qo8Tw0CKnFhA+7c9kavWXp3t2vYiILnHlR?= =?us-ascii?Q?n8VAbI8MxTaB6e+NZOUpMT86dBMyiziekNs+04HPUr4SP73tG2ix5Az6/9RQ?= =?us-ascii?Q?rmr01HZkzJaljbe3KV7eSSWUnoBgd+2179NuwUtgg1v6B35zG4TG1VTBF5/X?= =?us-ascii?Q?SKq6WD/J+hjKRysKNQ1F6rRnyr6YtKu+EkS3QkWrPoobuAW2t/3fOk8tYaYO?= =?us-ascii?Q?sHYsqddsFSKUA0i5UF0sHJhzZGXreMcTDyZkn4FeTSRNajzPv/cXigYBygW0?= =?us-ascii?Q?+GksRWEJUPrNumbFC2NBLS+vNOx3CU3IyAeostPEgnDZPQ578G6Y1j0hFZ+Q?= =?us-ascii?Q?++T5w045Kc8O05SDUBgCNqHSV7Q6CR6TFlXligSKtpIW3yuJGp/3DeuAoDi1?= =?us-ascii?Q?R5YuXauauaS7hAcANOouHXkWrXT2EERihugtonMePKNZvr+Y3R9e97nn7qdy?= =?us-ascii?Q?vnMDjxVFIS38foh5+CGbUbWaCQHSqHiuARcoX0z+HGhKwNm9MsSm/G61aswo?= =?us-ascii?Q?wiJpGAdK+QFXSHf/DuE0qpMAnPOtCW+cav4EFDQ3n+Xgn6S5vfkUXGtA+xWI?= =?us-ascii?Q?0/TZFJ3JJBWwvOb2ccfA/o4f6/mCA2FIYBykC+cUiKRv5hFXw4desudocphu?= =?us-ascii?Q?GruA4OxWzF+OLYikFr02L1bsMeT1bEITTz9DUCkprWIpOe6Z0DExq7fFCga7?= =?us-ascii?Q?bKgdWlxRN8YvpCpbNvKF4Y9WkKAjnp3jPGnl74ox0lQ++ns/WLVC5dzsGgPB?= =?us-ascii?Q?C0UNNjiQlhvgz4DonCkflrmo47F+rvLGijZ7cgrW7JVF+zfWFnPLPdGGZLbJ?= =?us-ascii?Q?P0l12pkhwofFkcngIcwafJp86Fho2tQeyldHEKCZOzeSpTKPwhwDfMyuWXJc?= =?us-ascii?Q?1BA=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: CH0PR11MB5523.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5764a1a2-f464-4374-9cb6-08d904762c2a X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Apr 2021 03:33:04.2093 (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: Gw4VC52kCFEcy0TJPzzR4Wgn0gycKAZ+zV/a09rfmz/+J/u301aPErvu60duzxsbMjZmqtxjRfIwaysLSnOaXQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR11MB4391 X-OriginatorOrg: intel.com Subject: Re: [dpdk-dev] [PATCH 2/2] raw/ntb: check malloc result 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: Min Hu (Connor) > Sent: Wednesday, April 21, 2021 10:08 > To: dev@dpdk.org > Cc: Yigit, Ferruh ; Li, Xiaoyun ; > Wu, Jingjing > Subject: [PATCH 2/2] raw/ntb: check malloc result >=20 > From: Chengwen Feng >=20 > This patch adds checking for rte_zmalloc() result when init intel ntb dev= ice, also > fix the same bug when start ntb device. >=20 > Fixes: 034c328eb025 ("raw/ntb: support Intel NTB") > Fixes: c39d1e082a4b ("raw/ntb: setup queues") > Cc: stable@dpdk.org >=20 > Signed-off-by: Chengwen Feng > Signed-off-by: Min Hu (Connor) > --- > drivers/raw/ntb/ntb.c | 5 +++++ > drivers/raw/ntb/ntb_hw_intel.c | 5 +++++ > 2 files changed, 10 insertions(+) >=20 > diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c index > 0f0e3f2..6703bb5 100644 > --- a/drivers/raw/ntb/ntb.c > +++ b/drivers/raw/ntb/ntb.c > @@ -923,6 +923,11 @@ ntb_dev_start(struct rte_rawdev *dev) >=20 > hw->peer_mw_base =3D rte_zmalloc("ntb_peer_mw_base", hw->mw_cnt > * > sizeof(uint64_t), 0); > + if (hw->peer_mw_base =3D=3D NULL) { > + NTB_LOG(ERR, "Cannot allocate memory for peer mw base."); > + ret =3D -ENOMEM; > + goto err_q_init; > + } >=20 > if (hw->ntb_ops->spad_read =3D=3D NULL) { > ret =3D -ENOTSUP; > diff --git a/drivers/raw/ntb/ntb_hw_intel.c b/drivers/raw/ntb/ntb_hw_inte= l.c > index 4427e11..a742e8f 100644 > --- a/drivers/raw/ntb/ntb_hw_intel.c > +++ b/drivers/raw/ntb/ntb_hw_intel.c > @@ -148,6 +148,11 @@ intel_ntb_dev_init(const struct rte_rawdev *dev) >=20 > hw->mw_size =3D rte_zmalloc("ntb_mw_size", > hw->mw_cnt * sizeof(uint64_t), 0); > + if (hw->mw_size =3D=3D NULL) { > + NTB_LOG(ERR, "Cannot allocate memory for mw size."); > + return -ENOMEM; > + } > + > for (i =3D 0; i < hw->mw_cnt; i++) { > bar =3D intel_ntb_bar[i]; > hw->mw_size[i] =3D hw->pci_dev->mem_resource[bar].len; > -- > 2.7.4 Acked-by: Xiaoyun Li