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 C11E6A0547 for ; Thu, 1 Apr 2021 10:47:24 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AE042141011; Thu, 1 Apr 2021 10:47:24 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 4AB0940142; Thu, 1 Apr 2021 10:47:21 +0200 (CEST) IronPort-SDR: JccREUUEBSdZB5OaGhXr+hA/qWpB3aYDovZt/74g8PA1oIgLSHrGMaUSlCS9/W+Pl+YaTa5vpS U6SC3wCsuFwA== X-IronPort-AV: E=McAfee;i="6000,8403,9940"; a="256172462" X-IronPort-AV: E=Sophos;i="5.81,296,1610438400"; d="scan'208";a="256172462" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2021 01:47:15 -0700 IronPort-SDR: 7n4HGK5k93xwS19AFYxb2fPD4/k1SHPkzmo+9BT/g4Ab6HiM4eZbec2Z/63MtX9t1sdVV/9QrB H1OadcfiBqog== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,296,1610438400"; d="scan'208";a="446149311" Received: from fmsmsx606.amr.corp.intel.com ([10.18.126.86]) by fmsmga002.fm.intel.com with ESMTP; 01 Apr 2021 01:47:14 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) 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; Thu, 1 Apr 2021 01:47:13 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) 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.2106.2 via Frontend Transport; Thu, 1 Apr 2021 01:47:13 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.104) 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; Thu, 1 Apr 2021 01:47:13 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dFsDvFwKOylibtwpObgYB042qux2t/AVQkdBe3lEBXKOPHPXkpX/aFX+D0hsjVMnzFFQQNGdXE3IeZ5kODs82MGLeVA03SClgHgmYcGpeZtwzzanpLizJ94ttOviyHUsPsbaEk7bCNk8A5gvA7NAK5kJPcwmLl1xWv8tsMCoYgap4FK/Y9vUvWKE+VlyPZuBOQG2dECFHfuNj6fyZpO7hs05mZwEkhCJWrY+f2KOBNRBNWkWRwnJJU1I3m9Dh3JoAu+B/+S/3edgw+jHigtNyVgZJl2A84UliU0ijXTxczt7bvIWXviEwlffC7FeS+oF2V2fFvE9/t2IbmPM5gZYUw== 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=G+w2vFgiATLiDh1VcB2SX8f9khjxGnvtGKoMyO3bfNw=; b=iv/CDkHigWis5+NqlBJF/YFRXg7hir7Q8R27KKpwOqvPWVZ5voq9Fuhf1oIDPw+RfxCU16LzC/LbH4KQ5ivmzi8MF64lb2mLl/mDBGA1vuItLBaf8maj0BpwdJC930fpYXu76pAX2ZDF0Nm7EeIFV+3c7MWh6C5Zi6jz7waT9OP44VxLTm+Evu0r8jhX6Dmxa33oPl86rWmWYuZbmjqQziJM0TmjAYjFAhCXGNizlYnso0Kw+n5xfGGohAmW8yMeSYJmNbnfJDd33TZnZ94M6QO+ooWk/haNexN5JhuFcFu/MP/mJxfz4RTSaAJnu9yrftSq7yHmO6kWA2k6QL9FRQ== 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=G+w2vFgiATLiDh1VcB2SX8f9khjxGnvtGKoMyO3bfNw=; b=gP+kFSh34Fpgzj+Eslfdmb1PDfGfcILHBbNLte/KUOYHI15DZfDMIpIGaN3K8teUVWRuYhNYAYLf3vFJQDmCe5SPK+t0VT95xxAk25lZZBps5fA6MfPIcO56eRX8Vq11Ts/88PcpRKkT9q7FI1ElVTnVqoo+o0MQcIWydVO/ukk= Received: from BYAPR11MB2901.namprd11.prod.outlook.com (2603:10b6:a03:91::23) by BY5PR11MB4305.namprd11.prod.outlook.com (2603:10b6:a03:1bf::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3999.28; Thu, 1 Apr 2021 08:47:11 +0000 Received: from BYAPR11MB2901.namprd11.prod.outlook.com ([fe80::4447:5f1e:984e:57f3]) by BYAPR11MB2901.namprd11.prod.outlook.com ([fe80::4447:5f1e:984e:57f3%3]) with mapi id 15.20.3999.028; Thu, 1 Apr 2021 08:47:11 +0000 From: "Xu, Rosen" To: "Huang, Wei" , "dev@dpdk.org" , "Zhang, Qi Z" CC: "stable@dpdk.org" , "Zhang, Tianfei" Thread-Topic: [PATCH v1 1/4] raw/ifpga/base: use trusted buffer to free Thread-Index: AQHXGwaLCqNoITqSUkSgKyXv3Q41VaqfcRrw Date: Thu, 1 Apr 2021 08:47:11 +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: 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.102.204.51] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 4dba6739-9e3a-447c-0189-08d8f4eabdb5 x-ms-traffictypediagnostic: BY5PR11MB4305: 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: xiIv+9XeRkEshpkx0ZXIhiVQ5xpTA+n7xHNMrFHVWFJ6rgfON+bHnGLqlcT4d437NyCU/2dyMAGk1i3/szu4dZMkV30awKtrNKNCMupC5dj23FiIaINxHEaSVQiXx/PMEh32gjyJILgrYmpNFfJ0M6cNKNxG/il0oIpS2AfRsv3K99gFwk4pk5KZghYg1Lh3pTPHEvLZYAUr2Degm1OvlwRWYuypo5j7DSRz1P3Lzjz6fKllh7agyiGwnzoTJMB3b5ALFBD9AakfGTnwWQDr6SOnJgaThBFPXmMCg9jUAJy+encNvpu+yYeQXpgTkvwGlGI1u5kzgfiXWMbIb1iN8tM0mwJoNRooy6jmVzmzrmgz++tlgSlFXx9y3QQxPERl21OcumHj5HWj9fEN559vG9Hs4BkRcVLFPq/q78fnKNc+Rvf2YESq5ZJ3WSr74z7PeZfjIYOAEDrB+37KGLS35Lgeli6nZNAQUCTVp6FgqfYsK6jEDQ7N5xH5W74kpor3SW4QOzBCCynEV0wbnGEVx4HfhSSuSIPLQvr5J5Zz6ZVkndvuPRjyZFQT1knLJlBfot+T+EdWaMlSbupGD+qZqNPTtrKv44uLCORGV5E24o+RRssh4SFYSbih7ROiLjcMMnGVqvo7FDRkkxDSDyb4MaKr7tHILwRdEd39RZIi/sA= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB2901.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(376002)(136003)(346002)(39860400002)(366004)(396003)(38100700001)(8676002)(55016002)(9686003)(71200400001)(54906003)(110136005)(8936002)(478600001)(4326008)(53546011)(107886003)(450100002)(6506007)(7696005)(5660300002)(186003)(2906002)(26005)(76116006)(316002)(64756008)(66476007)(52536014)(66556008)(66946007)(66446008)(33656002)(83380400001)(6636002)(86362001); DIR:OUT; SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?/kiOIs0CQd+Ep+6L3hCLpTFE9rRngsp9HmZY46KxCi8njVI0RV7/P0QXmg+L?= =?us-ascii?Q?VPIjdALI7BxG0Dc0CFScs7egGlltzPQFF/KTHdrtDV5nKdSf7KU6SLweBGKy?= =?us-ascii?Q?T85BZXwCD5ZxyyYCXjldp5ZJwNrr/1qWL3ItuJiwXsqan9lIc6x0BbxoKN4B?= =?us-ascii?Q?Gz1oVP95SEkp+TupBwkdQ3+aAT816TXw9lVs0c6vQVv32M0iqV7asTMU3gkC?= =?us-ascii?Q?9UQexaQro7N/KsBvH0RTi3dW3ryJIct9F13mRyQESk7qZC4X4SNNPDqlBFWh?= =?us-ascii?Q?Oj53DyYIcGrwA6h2GOlnW+74kKpV2vNhMnuNFHzT/RNW8SfsRsmysK4ytjLP?= =?us-ascii?Q?8u0ovoy0WrIEM9kjAZbj7bPUqGjkHzA8654FFgPDixBA/oiTvgQwX2GJiq5v?= =?us-ascii?Q?bPzS6D6rhB39VqOmoIl68ZcJBuBT0HmY7YQVe3RyDoKHwBUT81LHBO+/lYWk?= =?us-ascii?Q?TsYZ4y/dwls6jL/Fhfupixjlu11WADO+psQYEr6CB2Y1WJxsilfUvt+VxDIm?= =?us-ascii?Q?dfk+K2z5/rPZQVOoxVIdDK2MFY0l05ySAePkHneDLSI2FNWa0o2u+hqDiGae?= =?us-ascii?Q?hQFweHmW/v55ry1kU4DYt53Ui8vBvDWIPO/w4TwoPebBdYjeU7BfRV8jIT1m?= =?us-ascii?Q?5aMrgd2kG8XqnHcvDdIevuE+wZ9PqTGmiP+2PYn3A3O18ZZgQeDsj+hmSTEo?= =?us-ascii?Q?4jVLdRJN6MI4dd7h4PU9/A7BaMFy/re6wnNWis++oANunrIzTrgPSXSiYJi1?= =?us-ascii?Q?rliT7kTLJJ4s7W0bTwid7M3aj+ro7HlAoXdpF/CgaO295bamYan2fJeHgb5N?= =?us-ascii?Q?dRUIBNVFGSevO0UekHzPhKy2k44k2fBcWjhBfTIEcKZjDtqQ99zXr34Duxxp?= =?us-ascii?Q?ZGwx/njHRCY7OgNqV26MS4EFp4YmJCFtQaX4eaRqVJY9yxnbQzd01gU7sNgu?= =?us-ascii?Q?RQNvGYHRdnZxvn+1EWe1YVdciQsRbreN1BG7zudk3YgVIMBgUPPmErMaPXtM?= =?us-ascii?Q?POT+efImiNj6qQy281VsgY2egI1cO/u8MlQkdnrKL+d29Uot6AUJvjxvozRF?= =?us-ascii?Q?viiXvdSttz3uPu1EPRirBcGh9+lV5oc/ky6XJcZhHCAB6PBCIq5vyKDJu5Jk?= =?us-ascii?Q?RYa+ugjNUh4IbfRPtKG4kPlwPA++fTEPnIaZA6OgBdHUDI+ldDCJFQZiRyRC?= =?us-ascii?Q?+0cyTMx0VjU7ez6LOj8h5pmOhqsJwU8V5CoHTGQSH/d8kK109M1YJqGLkJHf?= =?us-ascii?Q?SJJGlrTFJFHNws1ubYJqZ999f1YkMO3De7X3PUTL5O+NfCHqHFzuUb6udtAj?= =?us-ascii?Q?S7PIH1e8Nq4kyDf7XXfYHFB3?= 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: BYAPR11MB2901.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4dba6739-9e3a-447c-0189-08d8f4eabdb5 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Apr 2021 08:47:11.4466 (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: tsRhf0oNs6w/SWIVfkn+6k9EW9Cus61G3LEd5X1MeAdARuc4m8yimfjxUWzpVc0w/MEhOAqbM2X/aiTj4cQuBw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR11MB4305 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" Hi, -----Original Message----- From: Huang, Wei =20 Sent: Wednesday, March 17, 2021 4:22 PM To: dev@dpdk.org; Xu, Rosen ; Zhang, Qi Z Cc: stable@dpdk.org; Zhang, Tianfei ; Huang, Wei <= wei.huang@intel.com> Subject: [PATCH v1 1/4] raw/ifpga/base: use trusted buffer to free In write_flash_image(), calling function "read" may taints variable "buf" w= hich turn to an untrusted value as argument of "rte_free". Coverity issue: 367477 Fixes: 7a4f3993f269 ("raw/ifpga: add FPGA RSU APIs") Signed-off-by: Wei Huang --- drivers/raw/ifpga/base/ifpga_fme_rsu.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/raw/ifpga/base/ifpga_fme_rsu.c b/drivers/raw/ifpga/bas= e/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; } -- 2.29.2 Acked-by: Rosen Xu