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 A5326A034F for ; Thu, 1 Apr 2021 09:47:17 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9785714108D; Thu, 1 Apr 2021 09:47:17 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 2558D4013F; Thu, 1 Apr 2021 09:47:13 +0200 (CEST) IronPort-SDR: LN8uJHvf7JMzPSSR0VAR8ChnHQW3jlMd9f6oc/p0CUzYDaBFSZgFAUiwZI2UEXIBznSOkLnHsq LWPCRVTTMD4A== X-IronPort-AV: E=McAfee;i="6000,8403,9940"; a="253512878" X-IronPort-AV: E=Sophos;i="5.81,296,1610438400"; d="scan'208";a="253512878" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2021 00:47:11 -0700 IronPort-SDR: iuGBUH0wFgyhJGePJ/PMuT1p6ZkcPXnwO9M7aMNkAmv1RxwycrWGp60p13WNMJ9VHtMv2qFFLs uM6grzaNIKLw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,296,1610438400"; d="scan'208";a="446124168" Received: from orsmsx605.amr.corp.intel.com ([10.22.229.18]) by fmsmga002.fm.intel.com with ESMTP; 01 Apr 2021 00:47:10 -0700 Received: from orsmsx604.amr.corp.intel.com (10.22.229.17) by ORSMSX605.amr.corp.intel.com (10.22.229.18) 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:47:10 -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:47:10 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.42) 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:47:10 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a/wnmcNlvnhsjnP5PYjREeZEFlDbVlTsuUouLTf3UofblBOGQCu2D21n40gwh7RKC0W3w44gcUEMnaN9xGgfA5jvHBXjCk/5C+jotBXqzmwcb1n1THqiKMSreO3sAJbiPnMYjHLRZhhH7h9vgxueBt5MS1jhtICO72jipCYHywiMqeH6YBr1NNbZj/qMH4Ey+FKsClJVuCr68oUEwlLDChWUmA8OYYw7ASHtbg4tmfoQ0lciAeN26V2bHdg7VxEMsiXcHXQtXh8YfeD3lQWeq4SVtpiREVJiN8GVed7dJg3CRtQVZcGkGQ6ANS3l6AU7dcMJ6kEwXiujjqU/9h3oQA== 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=xkc7nYoyjYqMaAMw8MQ2EyXcQPXf6eK1bm1Fx6R46Z4=; b=AB05LXLEvvsQsaGhvKgOyngayEuj+XzwyKejKm3XAzHFCbXzAxEtD5dNOemPcuFrfuNdVl2sw5GXLKIu+XPfRJhYn2ZSmO61HIJCGn3543aqgDBkbt9R4ZCN8r+FPvXck4FQ3mPu0lW/2V+nRfKuoNm3KOz6GytYr0vD5HUpCO0Y/QQyKLUqeRke2Z4CUGtoG73MgsIzV17tyf8irJTS8WWQMdbRyrc+J0TVMXA4heOA7uWAIY9hDmK37dmXHR6oosMNeQP2USLACBrxbZFdxbnQzJ3XAh92Ku7febNTr/JN9BCZlg5ri8cTNeojUO0spEi7ANGfsiUi65j2vgjBrQ== 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=xkc7nYoyjYqMaAMw8MQ2EyXcQPXf6eK1bm1Fx6R46Z4=; b=N0ACa83BKxStd1RE6LNjLi7wdURzSJfVRzWcfYQwFQ0Pr+3zY7JAG+p6ft2vNRbjpVwj2Lhu1forxwWgsIJsqQpt5NP891DyzQMlkfQORmRwixCfbCQ+u6PHmgLJSDdv9iiAZfYathpK2W4CQ3RilSd/YO2e4DHthyAOomY8Rho= 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:47:06 +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:47:06 +0000 From: "Zhang, Tianfei" To: "Huang, Wei" , "dev@dpdk.org" , "Xu, Rosen" , "Zhang, Qi Z" CC: "stable@dpdk.org" Thread-Topic: [PATCH v1 3/4] raw/ifpga/base: assign unsigned value to length Thread-Index: AQHXGwaN6raNmYE8UEC51E0qM9mP9aqfYE1w Date: Thu, 1 Apr 2021 07:47:06 +0000 Message-ID: References: <1615969296-17021-1-git-send-email-wei.huang@intel.com> <1615969296-17021-4-git-send-email-wei.huang@intel.com> In-Reply-To: <1615969296-17021-4-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: fabcc0b5-b646-4e0d-3d48-08d8f4e25905 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:43; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: tGha9RaKmmc2ZshTbvmKBZ1zhS4nXshv/u0jJKhXBUayQOCuIL5ssgdHNU+dITNf08Wa27UAQkXqXXmG5fXKK07TkBLB5BvY6u7pHK8mjzktw1xoZXVPnI+zRCY4OvgmBMFxezBivys8b2tcOKpu5aLkFhsEHKnuoUEDUXbw9WVkD6vTLm5W+RTb4YkoPKF6nARfmaOw6BmNCddUo8L/bdWszNw/BwksVXuR4mCRkXT8mi/4o6ze3ciwgkKRx9m+i46ATGDLMrFt1gJYea1n7UO/pdrF7rQsmobxx4Z94/1Y/p3iQqH4462Rf+dVARctviEMSKXg7K/+Xgpp+H5xWTTIlCvE9MqrmR7lVs5aQATU5knWfQPl1ewBk+l/zn5b9C3zQ/LLNVPwkGoH0ufFbDtLUtLDjqG2BMhbEvFmBNB2nrFRNleDNLfDj0darPxmgimy5QRn4dlkUDSWgXk1K1PWL/ka/4nlNC5L5yPGyndd+lM2t4KPKC+QBMgZrNTKM1xXppkcSIqkhoW6t9uThiQK7A0CPW6WPI6octrANqXiFf09ydxrqxhoMJJ0gsgIFehzZchC/Ldyxf+CX71ALQTWBF2ogsgqO1uwEp3TkBKFnJ3DeXTOUbSQmWAejnMD7CQr9uDfegJyjgsR2mWIdhQ3X5bcKizBkIY/ReW4fy4= 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?QWpBRkJxU2NDV0ViM2NnUVpKam1WRlBuVVRTb3Q3Mk1ndjZFcnpsbGtz?= =?iso-2022-jp?B?ZzFCMFRQMUFOTW83QlI3STJLbDErR0Nld0ZJVXcwV2RYcy85ZHpUZU5z?= =?iso-2022-jp?B?RTBpUDVsaDNlM1pLNlVhZFpDV1JvcXJNeklTNUZjczhMRUtXQ2JDQUdu?= =?iso-2022-jp?B?cTkyb2RtZG9XYWRGeENKRU1henZ2Q0VWOHJaZU1GNG4vNTlGcWNWa2lV?= =?iso-2022-jp?B?MG54WFVlYlU2UnVkTjQ4WHZrbTNqSzh3bkFwU0Q3ZmM4a1FzWlhBL3Mv?= =?iso-2022-jp?B?YzJTYzlOanFZcUVoeUhyUHJ0V1l2Ym9wa3JkNTJOL1pBUzVtdks5aldR?= =?iso-2022-jp?B?Nmp2WUpabHpsaXJNbHg3YUtjL3BwaEFJdGpTZ0JWN214OHJVQnRNakI2?= =?iso-2022-jp?B?RmVMUkVqTVhsTFlQRWFJRUdJc0tMZ29WNXdtdnpyL0FUQkt5WVZzU3JW?= =?iso-2022-jp?B?STN6Vk9xMjBJbFNQZW1zV1pnMS8xN0JKbmhZNVkrZHRKaXFQQW1lSTgr?=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2NYaEovS2Qz?= =?iso-2022-jp?B?ejc0em5pNzhqSXk2Skx4QjdVYXVJb3hqRnhZYVgxRTRkRGZ3c0dhaHBp?= =?iso-2022-jp?B?blk2bUh2eWJIMnJFTWhBOEtaOGptZUttM0tDcEpvQ3pTTTlYbTlQajBK?= =?iso-2022-jp?B?VncwS1JYclB5RDVmenV0cTJlZllYQ1hrbVdlNEd1QWpNT2VVSjNMMXRt?= =?iso-2022-jp?B?K1gxd3lxa21oTkdnWkFYNG9idzF5MGhaeVVRWDErWFEwNlcxczNBZUE0?= =?iso-2022-jp?B?elViZzFGMFp2aDdQRGp5Z3UrWjFUTW0xdVR4Ym5iQU9pa1ZvTFJucSt6?= =?iso-2022-jp?B?N0JvSFY2UFBPTlBXUDRHSmsvUVVSM2d2ZSt0N3plTmhGTVpUVFlOeVhR?= =?iso-2022-jp?B?T3dhQ0lTVVRoOHRMMjk5MlAzUmhGbytTbUtqa2lKNG9uQmJHcnRyaXJU?= =?iso-2022-jp?B?U3owUzNsdXRxakxCdVlDcWxKVjdpY3Z2andSZGdQWnF2emtIL2VFTW1t?= 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: fabcc0b5-b646-4e0d-3d48-08d8f4e25905 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Apr 2021 07:47:06.5007 (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: c9a+FZfhsZS0cjg4Z76AlLeMWkpSsoo6S21KKp73AZFFGR/15dRZJwZCyojKhoqels3G/vHdZ73OhVeEwqC4oQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR11MB3468 X-OriginatorOrg: intel.com Subject: Re: [dpdk-stable] [PATCH v1 3/4] raw/ifpga/base: assign unsigned value to length 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 3/4] raw/ifpga/base: assign unsigned value to length >=20 > In fpga_update_flash(), "smgr->rsu_length" is passed to a parameter that > cannot be negative. So return value of function "lseek" should be checked > before being assigned to "smgr->rsu_length". >=20 > Coverity issue: 367481 > Fixes: 7a4f3993f269 ("raw/ifpga: add FPGA RSU APIs") >=20 > Signed-off-by: Wei Huang > --- > drivers/raw/ifpga/base/ifpga_fme_rsu.c | 15 ++++++++++++++- > 1 file changed, 14 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 a4cb2f54ba..79ee37c282 100644 > --- a/drivers/raw/ifpga/base/ifpga_fme_rsu.c > +++ b/drivers/raw/ifpga/base/ifpga_fme_rsu.c > @@ -277,6 +277,7 @@ int fpga_update_flash(struct ifpga_fme_hw *fme, > const char *image, > struct ifpga_sec_mgr *smgr =3D NULL; > uint32_t rsu_stat =3D 0; > int fd =3D -1; > + off_t len =3D 0; > struct sigaction old_sigint_action; > struct sigaction sa; > time_t start; > @@ -320,9 +321,21 @@ int fpga_update_flash(struct ifpga_fme_hw *fme, > const char *image, > image, strerror(errno)); > return -EIO; > } > - smgr->rsu_length =3D lseek(fd, 0, SEEK_END); > + len =3D lseek(fd, 0, SEEK_END); > close(fd); >=20 > + if (len < 0) { > + dev_err(smgr, > + "Failed to get file length of \'%s\' [e:%s]\n", > + image, strerror(errno)); > + return -EIO; > + } > + if (len =3D=3D 0) { > + dev_err(smgr, "Length of file \'%s\' is invalid\n", image); > + return -EINVAL; > + } > + smgr->rsu_length =3D len; > + > if (smgr->max10_dev->staging_area_size < smgr->rsu_length) { > dev_err(dev, "Size of staging area is small than image length " > "[%u<%u]\n", smgr->max10_dev->staging_area_size, > -- Acked-by: Tianfei zhang