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 32162A034F for ; Thu, 1 Apr 2021 09:46:39 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 22D3F14107C; Thu, 1 Apr 2021 09:46:39 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 88E8E4013F; Thu, 1 Apr 2021 09:46:35 +0200 (CEST) IronPort-SDR: 2R3yfXoGkBIDzRivvqtzxTrz9+CbPmqt8IEMnG+mZcB87STFrxCfF6abTa8VdvAZklTEBhSxes E+O4gBVh0bdg== X-IronPort-AV: E=McAfee;i="6000,8403,9940"; a="179304772" X-IronPort-AV: E=Sophos;i="5.81,296,1610438400"; d="scan'208";a="179304772" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2021 00:46:32 -0700 IronPort-SDR: 4++QkyTdelDtA0+uLoxli82LwOTvMpCE/ix3+K1u96RVgurIADHMfqjVt2vIPSPXXCpfsOIEqi x8kPKpvhFV5w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,296,1610438400"; d="scan'208";a="455864751" Received: from orsmsx602.amr.corp.intel.com ([10.22.229.15]) by orsmga001.jf.intel.com with ESMTP; 01 Apr 2021 00:46:31 -0700 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX602.amr.corp.intel.com (10.22.229.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 1 Apr 2021 00:46:31 -0700 Received: from orsmsx604.amr.corp.intel.com (10.22.229.17) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2; Thu, 1 Apr 2021 00:46:31 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx604.amr.corp.intel.com (10.22.229.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2106.2 via Frontend Transport; Thu, 1 Apr 2021 00:46:31 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.41) 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.2106.2; Thu, 1 Apr 2021 00:46:30 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Z2trECi3kzlGNgbVpSBCmEVvm7iVL+2Nxk+GW7H5EZ1SKaUetMqzajUK3zy/IdAO9aB9o/0P/GCmM10/XuwKT98UMsz95N3wsD6qaOOtYPRlGcG744YDcr4EYoCVhxXtymzHmCuAfmDpCjp9WsQGZkwja+S00YT6RvLt2zaScde6YCTEXTdzZolm1Z8wxwdYOCEInYkAPg56Z32ZsPjy/J5Nv8BxAOfdKIPpT99URJo1Acw/iJivWig/Uwnx4XI7V/dyEXdekXNMEWhp9THCOuMCCsXUH7KDE2qAPyOadzK1oqtjSH6GPcz/D4HBtBuKr8rRjrwu1phDI4n/RMkq4g== 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=b0iUqR1QDUw+uO4oz73yPX6jb0tJ3RvZ5059k89Hq+I=; b=gkzEV37P38fB9Twzj3E/A0ohiKiN9+ugqUsxsrpl1Q9yXdj7bCBMTI0IZ1Iy/dPRJBXvnaQ9r8XEec/vakJU75ml67cVvvlAKGKztAS/rTPWLMEAjZaa9+mexN1AMW6NCPQ6J93Ev/E8rdazX+iB8u60/551a+tG5jHj41hQFsf/bzuVfSY1bHf2a4lq3dt5sQd8Sjo8jzFO0AOmCVCG8r3voFQPTmRzf99qo2tpCw+6RB9uUi3OSWzrLn/l7wv6iSUL439OHJus5mKiFpEoxVDb0QmF94TWg+29xXhzCVbYxuCTyOyivs2kCffP3P1InWIXf6R2izN1KxuYX47M3Q== 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=b0iUqR1QDUw+uO4oz73yPX6jb0tJ3RvZ5059k89Hq+I=; b=h2/Im8ZgaFjMZqyw0cZXLcH8T24AzmhmUBzZUgcjCZEMr6+dG5v7Zy6wfCmooJoP9xUdvcynogYVV9oO/+A+M3QvLw1RjoG/cYAfAe6jdQJaKKvCZLj2Y024UGj7v6Ht029CcJu8v76pCK7eOAZyAxSTY7QJRbM6Hx6HHHERMWY= Received: from DM6PR11MB3131.namprd11.prod.outlook.com (2603:10b6:5:6d::32) by DM6PR11MB3468.namprd11.prod.outlook.com (2603:10b6:5:5c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3977.29; Thu, 1 Apr 2021 07:46:28 +0000 Received: from DM6PR11MB3131.namprd11.prod.outlook.com ([fe80::181b:59f1:8b7e:b9db]) by DM6PR11MB3131.namprd11.prod.outlook.com ([fe80::181b:59f1:8b7e:b9db%6]) with mapi id 15.20.3999.028; Thu, 1 Apr 2021 07:46:28 +0000 From: "Zhang, Tianfei" To: "Huang, Wei" , "dev@dpdk.org" , "Xu, Rosen" , "Zhang, Qi Z" CC: "stable@dpdk.org" Thread-Topic: [PATCH v1 1/4] raw/ifpga/base: use trusted buffer to free Thread-Index: AQHXGwaL+rrqfveYMU+YHbgMOU4B1KqfX/EQ Date: Thu, 1 Apr 2021 07:46:27 +0000 Message-ID: References: <1615969296-17021-1-git-send-email-wei.huang@intel.com> <1615969296-17021-2-git-send-email-wei.huang@intel.com> In-Reply-To: <1615969296-17021-2-git-send-email-wei.huang@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.5.1.3 dlp-reaction: no-action authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-originating-ip: [192.198.147.200] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: c2379e31-d6d7-4a8a-03de-08d8f4e24217 x-ms-traffictypediagnostic: DM6PR11MB3468: 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:549; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: O3NIBn2rLp5e4fQOHYk41wjZ2MAuxwC5HnjH6YBh1MlKNuTZs4PsAAAFz87EZQfJypAb9VqcAOoQ1+Wo0bhOj/l+LfZrpWzDKkc21L5rtSUrBI5glgoTuN9OzwgQTfkog+Ije5S57cV81Mypz7nXIsto8td1/yjl047sZwil4eN/B3FlCgNwSYaUy1TcZyZBd9nnbQfgWGL2BtFlRBkFH9eYVFK6JPOi7TKCOuU8DzjptyW4fMhJzas2bYH3oV/yqBu2GPZaAt7uc1XiPAKqRd6IqeIt+tDzbwJHWe2dZ8vCYLDGLiAHPmhU9qvWB0alpgpZSlvHu1wUHg8I72ahOIBnCzEtiVYO8KU1T3MmzPq3DlggS7oUhzZUrhO8ZNw/TntASf1lILcoqZ3ltG1RxwDithtM4ZLS0ryC+NOx+uj+p9Ulx/uukDqJcUHpryCIC0IhKx7OwzJ6pIf8GoUXeH8G8X98P8YKpTMRvHT6Vg7WRt4AUQ5xrlS2ViMntjBRTNhlnffGgSnE7k7rFegGJspVyB/wMO+Fze9Em0wM6FtriWftt/3lHIdMa8a0nWuraxzLbdArQJMsZJWWa+uA/SX/zclt+1sNHM/HgW6IKkX2qRlbycpQY/taofqeAyY39MBbRYW2xY7vfhT6beTPEGy0Y4Pco4zQV/m4pkHLXO8= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DM6PR11MB3131.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(396003)(136003)(366004)(346002)(39860400002)(66446008)(33656002)(7696005)(66946007)(66476007)(2906002)(53546011)(38100700001)(26005)(316002)(55016002)(9686003)(186003)(76116006)(71200400001)(110136005)(86362001)(5660300002)(4326008)(450100002)(8676002)(6636002)(52536014)(64756008)(83380400001)(8936002)(6506007)(478600001)(66556008); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?iso-2022-jp?B?M2kxZHRQelFFcFB2Rkp5VEZYdG8wTzRkRFdWMmpZeHJ4WjVSRUZqajJE?= =?iso-2022-jp?B?UFVSOHdZTG8waUVTUnlxaHVReTZjUkQyb3VFU1lNTUNnWVlTWDZ0MjFN?= =?iso-2022-jp?B?Z0REdjNybDVVZjljaTl2MlhGSTZJZVd1RHJDTzl4K1RRY25OTEVwblRB?= =?iso-2022-jp?B?VytnVzVWOTdtZXZuVkZkTzZiRElzbEVzZzhGcmtKb0xJdEdUZ0s0VGUx?= =?iso-2022-jp?B?N3ZCd2xsSnZOQWovdGpOT1BJTHdLdXZMVkJBNEZJZU1jT0FVc3NOc0l2?= =?iso-2022-jp?B?SFljS0ZjTktkWXY3NjZ4a3F5cHpBaUJpTEVIWHdsRXRmK204RGNmQklJ?= =?iso-2022-jp?B?T1Jjcy82L2QreGZuc0Jya09MNGx3SDd2cmJwdmhoRTBvVWlBMDlRdlFE?= =?i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JTEdub01yRjM5?= =?iso-2022-jp?B?VnN0R0tFME93MDRDZUZzbHhyTldBMzBsdmF1dGZYTVlTSkM3RzREN2pZ?= =?iso-2022-jp?B?ZTF2MHJET1FDcVBEM1VZVnFvNGxTU2tzVHpaSWlmalBGVTc2RzFVWm81?= =?iso-2022-jp?B?bXFOTDhySFBvUnNON0xwbk0zeHgwaGs3U3VZTDliT2ROaDFWTW0rRnlK?= =?iso-2022-jp?B?MTE1Rjc3TXM2MlB3T0ZJNGNkUFVLL2RXSXpvMVRkL2pYTEJCb0lQUzBx?= =?iso-2022-jp?B?ak96aHJudzBvRFlBS2tpbk4wM0t2UE14b3doRjd4UUVHaFVuS1hEMlFY?= =?iso-2022-jp?B?aStyZkVtNnZveGZDVkQ2VCt1Tm44VXhPQWlBM25KZ3ZZVkxweHVRVGsv?= =?iso-2022-jp?B?bjFJZFFXT3NER085NGdkbUp2NmNQZjZ2dEppeExoNzRUbnVPVmZPWFFF?= =?iso-2022-jp?B?aVkxaCtCT3ZFckxSR25pbjYzZWlFWlFBZXl4bjlnVkcyZWtRRFRNNmtn?= =?iso-2022-jp?B?Ym4xbWJDYzVFNFhweFFhd1V6VXdSL0NQL3c2Z3pjT0ZxREsxdGwzQ2Zi?= =?iso-2022-jp?B?cmtDYXhYU0dWcHhWZ2FkeWtHSEtKaHV1VVB2U05KMEl1UHdhR0VRUkdm?= Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DM6PR11MB3131.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c2379e31-d6d7-4a8a-03de-08d8f4e24217 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Apr 2021 07:46:28.0046 (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: vU+5vQ9Qai0p0GqbwT5YehHSiwkXJ/aKRraFP9Dx2XssTIHEVVe500mgOuyt88+jxxVRV9Z77/D2NsSJcyBjQg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3468 X-OriginatorOrg: intel.com Subject: Re: [dpdk-stable] [PATCH v1 1/4] raw/ifpga/base: use trusted buffer to free 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 Sender: "stable" > -----Original Message----- > From: Huang, Wei > Sent: 2021=1B$BG/=1B(B3=1B$B7n=1B(B17=1B$BF|=1B(B 16:22 > To: dev@dpdk.org; Xu, Rosen ; Zhang, Qi Z > > Cc: stable@dpdk.org; Zhang, Tianfei ; Huang, Wei > > Subject: [PATCH v1 1/4] raw/ifpga/base: use trusted buffer to free >=20 > In write_flash_image(), calling function "read" may taints variable "buf"= which > turn to an untrusted value as argument of "rte_free". >=20 > Coverity issue: 367477 > Fixes: 7a4f3993f269 ("raw/ifpga: add FPGA RSU APIs") >=20 > Signed-off-by: Wei Huang > --- > drivers/raw/ifpga/base/ifpga_fme_rsu.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/raw/ifpga/base/ifpga_fme_rsu.c > b/drivers/raw/ifpga/base/ifpga_fme_rsu.c > index 28198abd78..d32f1eccb1 100644 > --- a/drivers/raw/ifpga/base/ifpga_fme_rsu.c > +++ b/drivers/raw/ifpga/base/ifpga_fme_rsu.c > @@ -92,6 +92,7 @@ static int write_flash_image(struct ifpga_sec_mgr *smgr= , > const char *image, > uint32_t offset) > { > void *buf =3D NULL; > + void *buf_to_free =3D NULL; > int retry =3D 0; > uint32_t length =3D 0; > uint32_t to_transfer =3D 0; > @@ -122,6 +123,7 @@ static int write_flash_image(struct ifpga_sec_mgr > *smgr, const char *image, > close(fd); > return -ENOMEM; > } > + buf_to_free =3D buf; >=20 > length =3D smgr->rsu_length; > one_percent =3D length / 100; > @@ -177,7 +179,7 @@ static int write_flash_image(struct ifpga_sec_mgr > *smgr, const char *image, > printf("\n"); >=20 > end: > - free(buf); > + free(buf_to_free); > close(fd); > return ret; > } Acked-by: Tianfei zhang > -- > 2.29.2