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 E26C7A00C3; Thu, 23 Jun 2022 07:51:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 31D59427EA; Thu, 23 Jun 2022 07:51:58 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 6CC944069C; Thu, 23 Jun 2022 07:51:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1655963516; x=1687499516; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=GF35z5y7KYoiU/C2qSppxJvC4XsMRmEttK51n6LyH34=; b=J6GGTPwTB+VSrT87P3X9teeg6kt/hQlWvK7owqZFXoplvCc2R2NxWWmo B2XIXfyonkEtxsW11OzdX6E6ly+Uava3aCcuiWb4pRBFTBYb8bBI9V91o mnkm/44JkygN22F+i/AowWfGR0SNJDGBG60dT7/nuQmSkUDRcnNwzlSsW bqzUhU80sJbgLpOJmY12+9RaVWhdwosOVl3f8zbdveYmVFNC7aRhE1EM+ UkhsjUzWjpg1O15x0ZIMLmdFike5foE05aK0ktQmO7Jj0+NK/bBLJcm5Q eWGkvRlGjDrUIGuawcZ8mx4SrunIGbFcsfERSt+DR7UBypmeN5I1KV8xg A==; X-IronPort-AV: E=McAfee;i="6400,9594,10386"; a="269356643" X-IronPort-AV: E=Sophos;i="5.92,215,1650956400"; d="scan'208";a="269356643" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Jun 2022 22:51:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,215,1650956400"; d="scan'208";a="730701868" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga001.fm.intel.com with ESMTP; 22 Jun 2022 22:51:54 -0700 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) 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.27; Wed, 22 Jun 2022 22:51:54 -0700 Received: from orsmsx609.amr.corp.intel.com (10.22.229.22) by ORSMSX609.amr.corp.intel.com (10.22.229.22) 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 22:51:54 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx609.amr.corp.intel.com (10.22.229.22) 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 22:51:54 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.102) by edgegateway.intel.com (134.134.137.102) 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 22:51:53 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QHs5asyExhoJPU21HSaFdc9bLRMF0pOUR2Rmx27M16xCgPQ0pCoYlt4tOA6IN9YctmZZwof+VtP2uILdY0Cf9tQHG91XWxfhcFy6aiQKOwEzcg+s0oy1azZ9rqP8WUBrlaeMEdrDhgO3VV2p0gCX5bXsuzasqsBWfs8dGrT42Ogilof/U6qmUHpUT0Xg5HhWDEIdAy0Bfha/BsUz8OjZWRJqYU3F5NzK4KanHjLSM/fUzhjDZGviv7B28Nt5bSv6X+YWB1Ak7qSSIgry8fVX3EjWw/sGECXmuW3I91ULbbzeBW87qvzas8W+7q9OsN5QE1lFwc7lZ9yIMAUW1Z1GPw== 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=u4sjBNLDCLkyJqyNSrHGCmpsW9PvBopZOcVp9foYFeI=; b=ZiAuRc0QPb0OG9PwE5LS0DArUKa6xd/GJKEFQKP8noi4ap8RyXMxiu1ZzaAGa4jt1AicrarazaLDjH5wgJ2pL9+qFmyfg3AZy4msbmMS5T0tmflqErRBKukELo7WsXtpU4xkHqqLcKtjBH2XDJqNvaJNulNtS2onngmxR4rbXShlp0Zyb765/JxeE/7XNN1EIZPhod9IP7l0xSaiD/EJnILsF3oi/Bv/dkcZ97/sXg+rTkf0RiM34AFhPk1UmYS2lz5ZLI6RievHgWI6huf1uVQXQ0Ccg1FDV/6G3/GEuR2n566pjewRwwruNB4noZMqdRMTLRziwf0EXQZZJvQeig== 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 BN9PR11MB5483.namprd11.prod.outlook.com (2603:10b6:408:104::10) by DM5PR11MB1547.namprd11.prod.outlook.com (2603:10b6:4:a::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.16; Thu, 23 Jun 2022 05:51:52 +0000 Received: from BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::a113:c892:d94:dd10]) by BN9PR11MB5483.namprd11.prod.outlook.com ([fe80::a113:c892:d94:dd10%7]) with mapi id 15.20.5353.022; Thu, 23 Jun 2022 05:51:52 +0000 From: "Zhang, Tianfei" To: "Huang, Wei" , "dev@dpdk.org" , "thomas@monjalon.net" , "nipun.gupta@nxp.com" , "hemant.agrawal@nxp.com" CC: "stable@dpdk.org" , "Xu, Rosen" , "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: AQHYhq3TEPMgwki5+EiRtBC/p1NkQq1cfRjg Date: Thu, 23 Jun 2022 05:51:52 +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: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.6.500.17 dlp-reaction: no-action 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: 80e3b2ac-e8c8-4249-29bb-08da54dc78c1 x-ms-traffictypediagnostic: DM5PR11MB1547: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: o3nqelEyXHrIMya66JGuYAB9jT8MmeWE2tj8f4g3Q+CCVxmGuuTtsMrjmsbjfBJk+Qd7DFezkn/Ygn6cKPfMnr2AlNLJq8vNVsbkkSStguFbbF1Q0mN8DEl4e+KPgYdAYkqgmtNmy+GDpcqKO4eKtLBp+7Q5onXUZH+zqjPfkIHscEBZz4nl4Ea7Azpdz5/XeAf4nAlzkt0GgSkYtqWubfjwL+dIma2/aJTjhrxTD7n23N1XIg5tQub76dw/nnui01ldrvY8LDLntKL91eUKuPTSa4yr0DKIm85ImhV3vPLcJlx6sG2Qbeu6/xE7pW3z72jM9+6KTNG0cjKuZLMAGCXw2eRVdH0eH/hM6h9QIiOb/EfnCOzzIAxFr0kcvewMVhQz2TgtoWXFTSnhnLevIHDpF3PRz7kvVnleejailc+ZTX/I+hIfUJcekrhi5auG3lHjUfZxRdkHk0nTeeeXfNp8xCqKsxWHAlj3oRbM3nIyM7GNfO1D2b9d/uUyVjgFUfA4WWHhkQfaKjqFWtqt6XVLZVc/I6dk1lfqHMWX5/MzI7AcitRWbbn2PWPzYpxl3iHmGHk4Yavng42d5pVpd2IMJWqM7LdK44yZw0QqB/bAx7X4JZqc9wc/FVzCr3xiYfKus0xXvHOOGRquaKIwhaVUAt+3+SDIYt/2HkzKlQsogw6ebsBJP+FYFUDWxniP3ox0wFpgud+YZZvCH2/WM4kjhizB4zZxcALIAJlajj/vfucnnqlRmEcVm7+2sT0wa2hYUSzUp8JIybL1YZuq3g== x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN9PR11MB5483.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(366004)(136003)(376002)(346002)(396003)(39860400002)(5660300002)(54906003)(71200400001)(66476007)(66446008)(110136005)(122000001)(316002)(55016003)(186003)(66556008)(478600001)(52536014)(2906002)(66946007)(76116006)(8936002)(4326008)(64756008)(33656002)(83380400001)(38070700005)(41300700001)(9686003)(8676002)(6506007)(7696005)(53546011)(107886003)(38100700002)(86362001)(82960400001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: Z0b+mRTEGVquzECD120pb9UxYUg809ZDda51SmMKFBt0mrn1W9tYDS6J0rSYzrXKzck74At4L7Sr7VCyrstOyCC7Z6EoctKDcWCOuyPFjjzk6ncR+W+aIkQ/kYfmjG/j/xhE44z4lXq7hQlQehjuhclBvRPvubdfZ8oJAYDHjtbDYeHS73us22WVEHa1yNm0JOkZU+h0Lg4qjDqnuRjEYoAT03swPK6NCjHBJpbiD9esj49x87Z8aoRwIbTMCM10AGVUDt8OcS2sk+xlAdP4uALHvlht/LZ9wrtrJ8uUUoa0f013EkDI9lgWdZj193fu9QgUpiAQ9085kf6b4QwrT8ErEhxGjUpAgiECVsUoXmoZfrLY/Oc1TQ8NigxHR7qcK9WiyiBEEodTk51K5i6OL7c2XrXGtBy+6X4B7Ih05WGDGtkzzpKXkqKBFqkH3YrGdhQ2nuE/4n0XVqO5y+YZvivnv+69hMwfdSsQkwqP0M5tsAbj3HZqT2tTCY0V6N23x5Sgx4eHe9wimq3nXm5v9g7BzoyNiFba62ROkfzwokvgc4k47LSZahJ3RnVUDMyCwOlVSddYffj6d7EtZ7hglEmUgBMjTpcGLGJub4hDJI/30o6eiEkkGviif9LIzvEtYcXFRWkFH88n2FtobvYpbgglKUDXfmWjrirPkgdYFP4LDXm7s+CjQwTWWacQhKPfk2ZzhdT0eucrlXJ++p/8v8uczLPbV93PUsheC7gce+dWuXcCL81q2ACr/cFYVLtxR0O5B7RCfmnqqHBZjwtLNmv6hWKqKn6cPKi19mIeXnJpvi7hcD0oytL7XZB0UYldjhOEhdtEDonx1FS06y7jpw== 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: BN9PR11MB5483.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 80e3b2ac-e8c8-4249-29bb-08da54dc78c1 X-MS-Exchange-CrossTenant-originalarrivaltime: 23 Jun 2022 05:51:52.1653 (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: a0Vjs72hVr+N/abcl5Yl63CAMHx4GMWjQ1WpJJUp7I0nP2YR7ISfHl1RwlYfJZIzzkmmkjrepiWm6PPsdMKeAA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1547 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 > -----Original Message----- > From: Huang, Wei > Sent: Thursday, June 23, 2022 11:12 AM > 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 It looks good for me. Acked-by: Tianfei Zhang