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 26A52A034F for ; Thu, 1 Apr 2021 10:47:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2014040142; Thu, 1 Apr 2021 10:47:50 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id C04C840142; Thu, 1 Apr 2021 10:47:48 +0200 (CEST) IronPort-SDR: A0hOXth0/PNn+QspkX8yu62/bnr6lWJN2kbhCSN2dnnfJtzbbWw/IuKAzK8Qr1I1RGzy4CjMHM oDE5yRPBtfYg== X-IronPort-AV: E=McAfee;i="6000,8403,9940"; a="191670157" X-IronPort-AV: E=Sophos;i="5.81,296,1610438400"; d="scan'208";a="191670157" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2021 01:47:35 -0700 IronPort-SDR: N0lj3xdrsw5dXsYo4TuitVPZQ1BpWa9eXxvqkYJbJt+s65oGkKd3WnQhCcIi5+BqgogLJRwT1D 8K0+CrsSRS/Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,296,1610438400"; d="scan'208";a="384772221" Received: from fmsmsx604.amr.corp.intel.com ([10.18.126.84]) by fmsmga007.fm.intel.com with ESMTP; 01 Apr 2021 01:47:35 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx604.amr.corp.intel.com (10.18.126.84) 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:35 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) 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.2106.2; Thu, 1 Apr 2021 01:47:34 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx603.amr.corp.intel.com (10.18.126.83) 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:34 -0700 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.105) 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:34 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=of2Zv8wocG+IulS4W2/57Gucm5u5t/5XGVG8yRy9q2HSqreEN6YrxtpVTRzF8AmScLVnWuchn4F5BhGeKXTE7/pQrWgi58aK0wfqtYoJtDDUg2xotKmocmoy7K69B34HfjDIE31c5A8BaNZMqfWx1pTwkcEaKusnafQVDT1TKXfipkQu9zFQLlvEuBHY0ohNk+bkwE56YnapMsZ7nEIC1sVzHPZn8L4aUtoqYCOUrnQNiMtJUjOUJ485z64rI9jvfghwhwA1KdbWPMisxJakco2cxlTkfGm0xhEumah67tJfhNvWXU4ke3g0AmjcRDuLd1g2IHRjhlDNi9khnBJmzg== 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=lSV1Fqb/YalLVj19ObefjtDOuIGP81Lw5NKU25ScYCE=; b=QlnzGYmj2vtSyUxLf8lMjroM/C88H4HWvsiA2QciugHb0P4azp3L0Ww8tqtC5Z8lppSkLmZ3nlb7ftREEzwjAtfYJovq4Poe/VVFmByO6OFINHvcXISjhanoJ0D9DrnSddr52GHYeEbr79y125f8ETyJ+PjtpNNfWxraO1QfgvUEZTPoCtCm/jnhJSJy6ufGApJpyQMz70wWAJzDsAmjjldpI5p21I8ef4d046kj3wEjDaz0eNK+niqDXIahWdnzYlE9xkRijDyaEkT+YlaP4BnoLRoNtnWe0vMP9SnxZDKt0r0bZitqQICaJBGkcTHLg7XIbJ3VTk93nNyVm2c3BA== 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=lSV1Fqb/YalLVj19ObefjtDOuIGP81Lw5NKU25ScYCE=; b=G8VN6x2lLes1w5KslPrnM9jo/UkS0M7njMofPyFKidwhaOxePRDA5OGxd6k6W63i19+SDfasSuHlwK45M8BeoYbsP6VKXnhlCn4rYXJOt9P0BgMzFJcLCMLoE6QPIGJ9RmAaih4AP2RrEr/gRBHBXfNHx4sb8JQ4N3gYOwhWrpI= 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:30 +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:30 +0000 From: "Xu, Rosen" To: "Huang, Wei" , "dev@dpdk.org" , "Zhang, Qi Z" CC: "stable@dpdk.org" , "Zhang, Tianfei" Thread-Topic: [PATCH v1 2/4] raw/ifpga/base: check return value of lseek Thread-Index: AQHXGwaP9gpIl07dNkK6RFvsNnFgA6qfcS/w Date: Thu, 1 Apr 2021 08:47:30 +0000 Message-ID: References: <1615969296-17021-1-git-send-email-wei.huang@intel.com> <1615969296-17021-3-git-send-email-wei.huang@intel.com> In-Reply-To: <1615969296-17021-3-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: 430d6240-dc66-47f2-be7e-08d8f4eac936 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:345; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 3GGX4kf+HQr/vVnQQlvILVnQQiHU0HHdspdKZG3EXjKBa9wk3kVK5BUCJ3S+KPxN44jHAetgNs4Kjg6U9ryQAUw6OAecdwz9jBO4S041DPXG1CgEW9KFnRDE9kEBkmXMaTJExiJqOrAK3tNXuIlrbK7KxHjxVKaZ/e7muPOxhiDCI9hDKnqKaEAn1+Y5T6IeBJfKnpFYflhcUIfF1pQeu4SjYMcuYut4+JUkdYutJath2PwNknTCDiCJyqOGcAe3Xm2aguyQubo0Y0Z+j3XxUtOBaGdxIQRu39i21gqD1tRm3QhpeZ2JrKz9jMJowLRL5hIkyRi4AQrjkHlACAG3ugCZMoUYw2N8ONkJk01vo+CnlXwWO9cMyeYl9lFiAESl+FGJKBJV9JrhunCpzV6BpzUEU63zU3U3GbuTchkQBGz1T56aS8jZySm1yS9D1O4wm6uhPJ9PdXhmYTo5GvToQAHaglm4AZ8ZTL2sxuOGr4VP4ZJ6EUW8HGs/dt+CwARIfFqQwOILNHC8rtFvWBQuSFFO9Irh8Fh8blNOXpswqWw0OmdP5m2Oqtoqp6ek4GVUV/yGD17eHL9FztintGw7UiJy9VOoy5WvVEPesg92FI5aEcEP0sIa9sWS/vH9ZDjvRDCS1j5gfVq6j+uZ03fR+p8k7XzMXVQLKQ2QPlww5nk= 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?Q77dIlLI0tujdjyVfe+RCy45bIoCMMGH0Yw8nrvnuW8S/9CICcXmqN/YDrLR?= =?us-ascii?Q?cAAzRDM+m3n/SvjIykBTqX+5F3XUkRG2kBlnVhj/Rl3xvrDwMUBGs2e32Po4?= =?us-ascii?Q?ZOmaHRdL9GeFUfUpwKzDpP+R6N+lA4Q+TEs8XITylp+Qirf3t6IRftwhWA25?= =?us-ascii?Q?r+iqJA9aeq32dn4Q2DpAMacwv3B2CwUXrqRG7T7/3Lp1TWcxaJzmvJu120e2?= =?us-ascii?Q?prSBJ3vdTdiIYm5YtygxS5EGGP7Ubet1PWa7LXgQAZkUNltoNLhTGbkDWsLR?= =?us-ascii?Q?GmuKhPqp2yQ3l69S3SobXv/emUYCPy2CkE152nLsTWb+6wE0ef30aUhkkH1v?= =?us-ascii?Q?Y9K2nXA8Xxtj5wTg7PDMt5miZMZdKm0lVLqQJKMeIiINLOd8Y/7qG7k9K7iY?= =?us-ascii?Q?gM7JWpqNIONVPo9/SZdG14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us-ascii?Q?iYg3u4yE6o7JKaHaKUN7z5ao?= 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: 430d6240-dc66-47f2-be7e-08d8f4eac936 X-MS-Exchange-CrossTenant-originalarrivaltime: 01 Apr 2021 08:47:30.7668 (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: 0xqDLhbl6+mxGLVTrTRbi4FwRfT/QxgRc2EztkwQOuU157AwEc5AihiyBv6b0ROwQ9UY1BxA0L0tsxihLs3Zrw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR11MB4305 X-OriginatorOrg: intel.com Subject: Re: [dpdk-stable] [PATCH v1 2/4] raw/ifpga/base: check return value of lseek 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 2/4] raw/ifpga/base: check return value of lseek In write_flash_image(), calling function "lseek" without checking return va= lue has risk. Negative return value should be handled as an error condition= . Coverity issue: 367478 Fixes: 7a4f3993f269 ("raw/ifpga: add FPGA RSU APIs") Signed-off-by: Wei Huang --- drivers/raw/ifpga/base/ifpga_fme_rsu.c | 7 ++++++- 1 file changed, 6 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 d32f1eccb1..a4cb2f54ba 100644 --- a/drivers/raw/ifpga/base/ifpga_fme_rsu.c +++ b/drivers/raw/ifpga/base/ifpga_fme_rsu.c @@ -130,7 +130,12 @@ static int write_flash_image(struct ifpga_sec_mgr *smg= r, const char *image, do { to_transfer =3D (length > IFPGA_RSU_DATA_BLK_SIZE) ? IFPGA_RSU_DATA_BLK_SIZE : length; - lseek(fd, offset, SEEK_SET); + if (lseek(fd, offset, SEEK_SET) < 0) { + dev_err(smgr, "Failed to seek in \'%s\' [e:%s]\n", + image, strerror(errno)); + ret =3D -EIO; + goto end; + } read_size =3D read(fd, buf, to_transfer); if (read_size < 0) { dev_err(smgr, "Failed to read from \'%s\' [e:%s]\n", -- 2.29.2 Acked-by: Rosen Xu