From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.8793.1582094055757789554 for ; Tue, 18 Feb 2020 22:34:15 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: hao.a.wu@intel.com) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Feb 2020 22:34:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,459,1574150400"; d="scan'208";a="408341319" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by orsmga005.jf.intel.com with ESMTP; 18 Feb 2020 22:34:14 -0800 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Tue, 18 Feb 2020 22:34:14 -0800 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.5]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.196]) with mapi id 14.03.0439.000; Wed, 19 Feb 2020 14:34:11 +0800 From: "Wu, Hao A" To: Gaurav Jain , "devel@edk2.groups.io" , Ard Biesheuvel CC: "Wang, Jian J" , "Ni, Ray" , Pankaj Bansal Subject: Re: [PATCH 1/1] MdeModulePkg/Pci: Fixed Asserts in SCT PCIIO Protocol Test. Thread-Topic: [PATCH 1/1] MdeModulePkg/Pci: Fixed Asserts in SCT PCIIO Protocol Test. Thread-Index: AQHV10XR5XjIzUYbAkmv942vGaqAFKgiJYBw Date: Wed, 19 Feb 2020 06:34:10 +0000 Message-ID: References: <20200130133804.32261-1-gaurav.jain@nxp.com> In-Reply-To: <20200130133804.32261-1-gaurav.jain@nxp.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: hao.a.wu@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable > -----Original Message----- > From: Gaurav Jain [mailto:gaurav.jain@nxp.com] > Sent: Thursday, January 30, 2020 4:18 PM > To: devel@edk2.groups.io > Cc: Wang, Jian J; Wu, Hao A; Ni, Ray; Pankaj Bansal; Gaurav Jain > Subject: [PATCH 1/1] MdeModulePkg/Pci: Fixed Asserts in SCT PCIIO Protoco= l > Test. >=20 > ASSERT in CopyMem_Conf, PollMem_Conf, SetBarAttributes_Conf > Conformance Test. > SCT Test expect return as Invalid Parameter. > So removed ASSERT(). Include Ard (as the driver contributor) to see if he has additional comment= s. A couple of general level comments: 1. I think the ASSERT can still be added after the checks you add. The ASSE= RT may serve as a notification in the DEBUG image that the service is not implemented. 2. I found that for functions: PciIoPollIo() PciIoIoRead() PciIoIoWrite() They also do not have checks that perfectly match with the UEFI spec. Ev= en though they are not exposed by the SCT tests, could you help to address = them as well? Some other inline comments below. >=20 > Signed-off-by: Gaurav Jain > --- > .../NonDiscoverablePciDeviceIo.c | 20 ++++++++++++++++--- > 1 file changed, 17 insertions(+), 3 deletions(-) >=20 > diff --git > a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverableP > ciDeviceIo.c > b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverableP > ciDeviceIo.c > index 2d55c9699322..76cb000602fc 100644 > --- > a/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverableP > ciDeviceIo.c > +++ > b/MdeModulePkg/Bus/Pci/NonDiscoverablePciDeviceDxe/NonDiscoverableP > ciDeviceIo.c > @@ -93,7 +93,15 @@ PciIoPollMem ( > OUT UINT64 *Result > ) > { > - ASSERT (FALSE); > + if ((UINT32)Width >=3D EfiPciIoWidthMaximum || Looks to me that the 1st part of the 'if' check is redundant. Could you help to double confirm? > + Width > EfiPciIoWidthUint64) { > + return EFI_INVALID_PARAMETER; > + } > + > + if (Result =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > return EFI_UNSUPPORTED; > } >=20 > @@ -556,7 +564,10 @@ PciIoCopyMem ( > IN UINTN Count > ) > { > - ASSERT (FALSE); > + if ((UINT32)Width >=3D EfiPciIoWidthMaximum || Looks to me that the 1st part of the 'if' check is redundant. Could you help to double confirm? Best Regards, Hao Wu > + Width > EfiPciIoWidthUint64) { > + return EFI_INVALID_PARAMETER; > + } > return EFI_UNSUPPORTED; > } >=20 > @@ -1414,7 +1425,10 @@ PciIoSetBarAttributes ( > IN OUT UINT64 *Length > ) > { > - ASSERT (FALSE); > + if (Offset =3D=3D NULL || Length =3D=3D NULL) { > + return EFI_INVALID_PARAMETER; > + } > + > return EFI_UNSUPPORTED; > } >=20 > -- > 2.17.1