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 9A19CA00C3; Thu, 23 Jun 2022 08:25:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 868494280C; Thu, 23 Jun 2022 08:25:28 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 058BB4069D; Thu, 23 Jun 2022 08:25:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655965524; x=1687501524; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=nR1wfywbYqnFmt3bSBaqAfR8koor50AYYOsvtnYl5Gs=; b=bKNNmI7CxSprWpi6EhDRw4VTOfVFz14P7iKi4VjSknDhrReOqDfihwFF Amdz6Pi4t22CQoxZkT5sqZ2uJPSY5gWOle0lIfyHnCU7f3Qbu4NICn3IT 65jHR9X5ZJRpAAYIoQ+B6t2qhYp3yGyNb1nRDTgXTMv1f50iQFnsK7xbI 68N/vkeABMVTPPFQiZ7lIBU3hIDn1ZCTAMFasMRF8Kp5pHZ4j79Bo5Llb 6RF8MXWN9RS4I9QSXSwxXUB3zQVZTCkY7SdClvspSq0PxDCT3zN4bu8KA 0IWJLwOlj6jeciMYc+5KlyKEKO5IXPl9/m0rZoK5Fa3nX1qW0oK9vyFBr g==; X-IronPort-AV: E=McAfee;i="6400,9594,10386"; a="279405906" X-IronPort-AV: E=Sophos;i="5.92,215,1650956400"; d="scan'208";a="279405906" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 23:25:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,215,1650956400"; d="scan'208";a="677923166" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by FMSMGA003.fm.intel.com with ESMTP; 22 Jun 2022 23:25:23 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 22 Jun 2022 23:25:22 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Wed, 22 Jun 2022 23:25:22 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Wed, 22 Jun 2022 23:25:22 -0700 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (104.47.57.47) 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.2308.27; Wed, 22 Jun 2022 23:25:22 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ESPpB+Y/MS4EyFRVGrI+XKo2+H8ioLXrqGy7LvEluF9ZkzcK16yqVB3wZ5+jBZVvjQe2sd3jGUWT9C7cQMiedDo6ODBiknJY8vDzMFmSv6egnqZGs8tK/f4Ztonu0/+j6t5dmEPKg3uwWUMint4uc8K/o1SSw1EhYVJDoGMcZcd1RV33GAu3CfD1onAteTPmBRu1QQPXM1O0+/E/6/ZvW2hp6oeRxCQTmyFb0RYr5Y7JdfWFtAMkIdTFiR1nmVIkGfPK30mfWAfCylFI9E+2xxfUBjNuHQGutisHRPg2eCkbF24PH+SIHgv+RHOMeP9a9Ou9W2PtZSL0QhmUq/TIiQ== 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=dKGaGJfyXg23o0I4yngJCkibZmzjomkbLkDuuOXpty4=; b=DuQoLW9YNhba8a2OgGKj0MBWtwZ6IvVF8RIFpFXrCaieQaHDvjDTHwa8oFHW69r9E6MFNiXWzPttWZl8SHfXt7LcPYQoJUjCiqyk9zdGKJv/tlTESilSCKbDZxl4sYHLVXZCXwf5IdjNkB/21nXpLxp9Vg1f/TLl8RG0qJgtIm7P7s/ttSY8+xmWo+J95v08Vukb7IkaM+CI+u03lnZ57PmPd8mC9RKyKMiYN9kTINg9uw8mrUnW/YQdOldnP0RXadMh9INo4SwWozzlgwbMKWfvPkxRXnAshPiOTmNjIofJxW+4tzoij60f0n9EI/HepUhjqeIhBeGJEo5RCBx5Yw== 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 DM6PR11MB4252.namprd11.prod.outlook.com (2603:10b6:5:201::26) by BN6PR11MB1636.namprd11.prod.outlook.com (2603:10b6:405:10::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.15; Thu, 23 Jun 2022 06:25:15 +0000 Received: from DM6PR11MB4252.namprd11.prod.outlook.com ([fe80::b9d5:600c:9f13:bc96]) by DM6PR11MB4252.namprd11.prod.outlook.com ([fe80::b9d5:600c:9f13:bc96%7]) with mapi id 15.20.5353.022; Thu, 23 Jun 2022 06:25:15 +0000 From: "Xu, Rosen" To: "Huang, Wei" , "dev@dpdk.org" , "thomas@monjalon.net" , "nipun.gupta@nxp.com" , "hemant.agrawal@nxp.com" CC: "stable@dpdk.org" , "Zhang, Tianfei" , "Zhang, Qi Z" Subject: RE: [PATCH] raw/ifpga/base: check pointer before dereference Thread-Topic: [PATCH] raw/ifpga/base: check pointer before dereference Thread-Index: AQHYhq3TucaNZWr9VEWaA72m+YrDpa1cho6A Date: Thu, 23 Jun 2022 06:25:15 +0000 Message-ID: References: <1655953890-26163-1-git-send-email-wei.huang@intel.com> In-Reply-To: <1655953890-26163-1-git-send-email-wei.huang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYTQ3MzAwMzItMmIwMy00ZTA3LTkxZjQtY2M5Y2MzNWU3OWM0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiVmpJT0VRSW5aZGU5d1djN0VnKzJSOVZEUVFLRFhaUWhFQndBdUFCTzJsaUhkbGRIaXhcL3RQUDBIajZpQUdRWUEifQ== x-ctpclassification: CTP_NT 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: 407dde4c-8505-413a-24ec-08da54e122ae x-ms-traffictypediagnostic: BN6PR11MB1636:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: hWKUgJG22n+jQZCd3/HjFRCgbsmKSJe0QQY3NBHby0QeDn5+5h9x7bJDxSHYtdDSC+Igd54GNtIeuf0Ts5u9aRb0s91Hlpq9ea3p9G3SRMz7CgK4/atns216UTeXVWM7olN9pA18FSkBkX+b6t813FDOSPku9AqQVfexnnr5rUMZOoZFgZgaDd8ISYPduEDga1ymyAIOrRt8uaF+811qvUjziaJ7ff9SoBPkX7PQIKPdoH5l66jXpbGOM7HBhLWdOVx8kulQQhFbtM+o34fQZxn+HKDNNc1orvwlZpKagW5Wgvy1G71WPweVKW4t2NSWsEPkl5CwfLzj1uWmsTFS/R5komYHdJawrVtCPvoIoLNWEkU5mSN6iV0XHZ1kYLmMvQdsHIIkDRogayr95UCGoW16j5NTHj7d6KfKPVpRm6i+i2BLy27kF7Sl+XzG3Odla3KGa6HcLDR/N52hAD+oGGc9UvIxlOcrL+MmYNwrISzQZ8PBHaaWak5oynb1uZ0ZpnPTiBYn9NFoZc7JmI9mjXOvjOoKgsZpd0/zrjoEQvqslY/nvld0xi+tWuO2bKAlslpNOsHiOkjhb2oZDaPNP5/6guqcLTpztGK49huepVw0dBK0HYfvT1D3QCFv/3zzVvtyuRnLs+F4DL0arIs/0WitqTpehStOB+vibH5nBfhE37tbCl5qlwMsSOg20CjxfqkOGbmatLvc6O7ipj6OXtegMP4HZw4n1Np6PUCmpMV5WEQL3VYO3CFWfYCx7k2fCANfm49L1QHcyEJyvYO2ZA== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB4252.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(39860400002)(136003)(396003)(376002)(346002)(366004)(82960400001)(122000001)(6506007)(54906003)(55016003)(38070700005)(316002)(38100700002)(110136005)(7696005)(4326008)(52536014)(86362001)(26005)(66476007)(71200400001)(53546011)(66556008)(66946007)(66446008)(8676002)(83380400001)(8936002)(33656002)(41300700001)(107886003)(5660300002)(478600001)(2906002)(64756008)(76116006)(186003)(9686003); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: YRcRPsmsco9JK9upAVO6lqUCUC+X/2Xt8gaJSNKGf9WdaU6nOYr7jxTsvD5PDXhsSswV9ULt7aw17aTUq2en2WPLY89fLLkXyZSVS+xCu80sck7EFjfsq1MDKfjbEU+BtjRQV1SD9nETrb3txW5PTqBXle9Ur74lVbFXVi9NrJQwVsc7SopOesa6YEUjpT3VUkhm+FI5UCWBclwzHpOMveD5g4KGYkG2M7eWjED6+UGV5pNRJWGq+mE9UXEd2cDHxWLIwtRRTVNKjQ3IM0IiMMc/IT6KdRIMkeWYaL0dpX4/2RME136cTkOVAkUhDOg41Z0pN0/ZCXelCtuiqVJBveBDHMgIa06s6T7E+TefYCZG1B03+va2MAti0xwE2+QPwKIvtqwOteGEEwxIUpICoJ7ckFDfq+ZyZFdcJuwO3mF5UhGlJvGrNAMYBgNti1LFh2EtA52d1vWjdLC4dxVojY+kN8Dg0FD/A2vC9fu4DOjuQ4xUo/RwXWpxulUcfu2piAttWN9u2HQ5ZjlSO9S0P2VAfmvaDcdTAhc5VuFEzqYoXfAP5/zPABzn7qdi848W71a8bQEYJfP/S/MugCmJ3hoUAGZJSmF4OgSi/hpltGB0/+tlsAJXTBCg4mo96rM1/alAtEVsM5B+f8ZaJFCKDopHhd1nVrN4ln8xBrd22suJTNt8z8JH1z8JqLQvf/b1cYpPSEIC8kjtJaOy/TtexVil4Zlq7VCDeeYp2eZ8lQ7c72k2TYBo2OQhhnK4AYCY53lK9bTykrXfVBqVzZixSw== 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: DM6PR11MB4252.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 407dde4c-8505-413a-24ec-08da54e122ae X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jun 2022 06:25:15.1934 (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: X+wPG7jnfBAL2e9I5eVkiXXQyhPkSWqw8hn6DhKU7Rg6XMLbS2qb678O6V+TMujQ8hUqx7FEkroni7mGNvoUGQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB1636 X-OriginatorOrg: intel.com 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 Hi, > -----Original Message----- > From: Huang, Wei > Sent: Thursday, June 23, 2022 11:12 > To: dev@dpdk.org; thomas@monjalon.net; nipun.gupta@nxp.com; > hemant.agrawal@nxp.com > Cc: stable@dpdk.org; Xu, Rosen ; Zhang, Tianfei > ; Zhang, Qi Z ; Huang, Wei > > Subject: [PATCH] raw/ifpga/base: check pointer before dereference >=20 > Do null-checking on hw->adapter in fme_pmci_init() before dereference it. >=20 > Coverity issue: 379202 > Fixes: ca6eb0f7c836 ("raw/ifpga/base: add PMCI base driver") >=20 > Signed-off-by: Wei Huang > --- > drivers/raw/ifpga/base/ifpga_fme.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/raw/ifpga/base/ifpga_fme.c > b/drivers/raw/ifpga/base/ifpga_fme.c > index 25ff819..b6dd4ce 100644 > --- a/drivers/raw/ifpga/base/ifpga_fme.c > +++ b/drivers/raw/ifpga/base/ifpga_fme.c > @@ -1591,7 +1591,7 @@ static int fme_pmci_init(struct ifpga_feature > *feature) > int ret =3D 0; >=20 > hw =3D fme->parent; > - if (!hw) > + if (!hw || !hw->adapter) > return -ENODEV; >=20 > mgr =3D hw->adapter->mgr; > @@ -1608,7 +1608,7 @@ static int fme_pmci_init(struct ifpga_feature > *feature) >=20 > max10->type =3D M10_N6000; > max10->mmio =3D feature->addr; > - if (hw->adapter && hw->adapter->shm.ptr) { > + if (hw->adapter->shm.ptr) { > sd =3D (opae_share_data *)hw->adapter->shm.ptr; > max10->bmc_ops.mutex =3D &sd->spi_mutex; > } else { > -- > 1.8.3.1 Acked-by: Rosen Xu