* [edk2-devel] [PATCH V3] FmpDevicePkg: GetImageInfo Add missing conditions
@ 2024-02-02 10:00 Pethaiyan Madhan
[not found] ` <DM4PR11MB529554272E24F0A5A4ACDDA499472@DM4PR11MB5295.namprd11.prod.outlook.com>
0 siblings, 1 reply; 2+ messages in thread
From: Pethaiyan Madhan @ 2024-02-02 10:00 UTC (permalink / raw)
To: devel
Cc: Pethaiyan Madhan, Michael D Kinney, Liming Gao, Zhiguang Liu,
Yi Li, GuoX Xu
1.For EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImage():
Add the following sentence at the end of the Image parameter
description. "May be NULL with a zero ImageSize in order to
determine the size of the buffer needed".
Modify the description of "EFI_INVALID_PARAMETER" return code as
"The ImageSize is not too small and Image is NULL."
2.For EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImageInfo():
Add the following sentence at the end of the ImageInfo parameter
description."May be NULL with a zero ImageInfoSize in order to
determine the size of the buffer needed".
Modify the description of "EFI_INVALID_PARAMETER" return code as
"The ImageInfoSize is not too small and Image is NULL." and add new
descriptions for "EFI_INVALID_PARAMETER" return code.
REF: UEFI spec v2.10 23.1.2
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Yi Li <yi1.li@intel.com>
Cc: GuoX Xu <guox.xu@intel.com>
Signed-off-by: Pethaiyan Madhan <madhan.pethaiyan@intel.com>
---
FmpDevicePkg/FmpDxe/FmpDxe.c | 20 ++++++++++++++-----
FmpDevicePkg/FmpDxe/FmpDxe.h | 15 +++++++++++---
MdePkg/Include/Protocol/FirmwareManagement.h | 14 +++++++++++--
.../SystemFirmwareCommonDxe.c | 13 ++++++++++--
.../SystemFirmwareUpdate/SystemFirmwareDxe.h | 13 ++++++++++--
5 files changed, 61 insertions(+), 14 deletions(-)
diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.c b/FmpDevicePkg/FmpDxe/FmpDxe.c
index 1e7ec4a09e..1d580c9f69 100644
--- a/FmpDevicePkg/FmpDxe/FmpDxe.c
+++ b/FmpDevicePkg/FmpDxe/FmpDxe.c
@@ -43,7 +43,7 @@ const FIRMWARE_MANAGEMENT_PRIVATE_DATA mFirmwareManagementPrivateDataTemplate =
FIRMWARE_MANAGEMENT_PRIVATE_DATA_SIGNATURE, // Signature
NULL, // Handle
{ // Fmp
- GetTheImageInfo,
+ GetImageInfo,
GetTheImage,
SetTheImage,
CheckTheImage,
@@ -417,6 +417,8 @@ PopulateDescriptor (
to contain the image(s) information if the buffer was too small.
@param[in, out] ImageInfo A pointer to the buffer in which firmware places the current image(s)
information. The information is an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs.
+ May be NULL with a zero ImageInfoSize in order to determine the size of the
+ buffer needed.
@param[out] DescriptorVersion A pointer to the location in which firmware returns the version number
associated with the EFI_FIRMWARE_IMAGE_DESCRIPTOR.
@param[out] DescriptorCount A pointer to the location in which firmware returns the number of
@@ -437,13 +439,18 @@ PopulateDescriptor (
@retval EFI_SUCCESS The device was successfully updated with the new image.
@retval EFI_BUFFER_TOO_SMALL The ImageInfo buffer was too small. The current buffer size
needed to hold the image(s) information is returned in ImageInfoSize.
- @retval EFI_INVALID_PARAMETER ImageInfoSize is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is not too small and ImageInfo is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorVersion is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorCount is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorSize is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and PackageVersion is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and PackageVersionName is NULL.
@retval EFI_DEVICE_ERROR Valid information could not be returned. Possible corrupted image.
**/
EFI_STATUS
EFIAPI
-GetTheImageInfo (
+GetImageInfo (
IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,
IN OUT UINTN *ImageInfoSize,
IN OUT EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo,
@@ -495,7 +502,7 @@ GetTheImageInfo (
// Confirm that buffer isn't null
//
if ( (ImageInfo == NULL) || (DescriptorVersion == NULL) || (DescriptorCount == NULL) || (DescriptorSize == NULL)
- || (PackageVersion == NULL))
+ || (PackageVersion == NULL) || (PackageVersionName == NULL))
{
DEBUG ((DEBUG_ERROR, "FmpDxe(%s): GetImageInfo() - Pointer Parameter is NULL.\n", mImageIdName));
Status = EFI_INVALID_PARAMETER;
@@ -544,6 +551,9 @@ cleanup:
@param[in] ImageIndex A unique number identifying the firmware image(s) within the device.
The number is between 1 and DescriptorCount.
@param[in, out] Image Points to the buffer where the current image is copied to.
+ May be NULL with a zero ImageSize in order to determine the size of the
+ buffer needed.
+
@param[in, out] ImageSize On entry, points to the size of the buffer pointed to by Image, in bytes.
On return, points to the length of the image, in bytes.
@@ -551,7 +561,7 @@ cleanup:
@retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to hold the
image. The current buffer size needed to hold the image is returned
in ImageSize.
- @retval EFI_INVALID_PARAMETER The Image was NULL.
+ @retval EFI_INVALID_PARAMETER The ImageSize is not too small and Image is NULL
@retval EFI_NOT_FOUND The current image is not copied to the buffer.
@retval EFI_UNSUPPORTED The operation is not supported.
@retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.
diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.h b/FmpDevicePkg/FmpDxe/FmpDxe.h
index 7baf730e69..d2ade143bd 100644
--- a/FmpDevicePkg/FmpDxe/FmpDxe.h
+++ b/FmpDevicePkg/FmpDxe/FmpDxe.h
@@ -114,6 +114,8 @@ DetectTestKey (
to contain the image(s) information if the buffer was too small.
@param[in, out] ImageInfo A pointer to the buffer in which firmware places the current image(s)
information. The information is an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs.
+ May be NULL with a zero ImageInfoSize in order to determine the size of the
+ buffer needed.
@param[out] DescriptorVersion A pointer to the location in which firmware returns the version number
associated with the EFI_FIRMWARE_IMAGE_DESCRIPTOR.
@param[out] DescriptorCount A pointer to the location in which firmware returns the number of
@@ -134,13 +136,18 @@ DetectTestKey (
@retval EFI_SUCCESS The device was successfully updated with the new image.
@retval EFI_BUFFER_TOO_SMALL The ImageInfo buffer was too small. The current buffer size
needed to hold the image(s) information is returned in ImageInfoSize.
- @retval EFI_INVALID_PARAMETER ImageInfoSize is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is not too small and ImageInfo is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorVersion is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorCount is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorSize is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and PackageVersion is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and PackageVersionName is NULL.
@retval EFI_DEVICE_ERROR Valid information could not be returned. Possible corrupted image.
**/
EFI_STATUS
EFIAPI
-GetTheImageInfo (
+GetImageInfo (
IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,
IN OUT UINTN *ImageInfoSize,
IN OUT EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo,
@@ -161,6 +168,8 @@ GetTheImageInfo (
@param[in] ImageIndex A unique number identifying the firmware image(s) within the device.
The number is between 1 and DescriptorCount.
@param[in, out] Image Points to the buffer where the current image is copied to.
+ May be NULL with a zero ImageSize in order to determine the size of the
+ buffer needed.
@param[in, out] ImageSize On entry, points to the size of the buffer pointed to by Image, in bytes.
On return, points to the length of the image, in bytes.
@@ -168,7 +177,7 @@ GetTheImageInfo (
@retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to hold the
image. The current buffer size needed to hold the image is returned
in ImageSize.
- @retval EFI_INVALID_PARAMETER The Image was NULL.
+ @retval EFI_INVALID_PARAMETER The ImageSize is not too small and Image is NULL
@retval EFI_NOT_FOUND The current image is not copied to the buffer.
@retval EFI_UNSUPPORTED The operation is not supported.
@retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.
diff --git a/MdePkg/Include/Protocol/FirmwareManagement.h b/MdePkg/Include/Protocol/FirmwareManagement.h
index e535bb697d..90b7d83c8f 100644
--- a/MdePkg/Include/Protocol/FirmwareManagement.h
+++ b/MdePkg/Include/Protocol/FirmwareManagement.h
@@ -294,6 +294,8 @@ EFI_STATUS
to contain the image(s) information if the buffer was too small.
@param[in, out] ImageInfo A pointer to the buffer in which firmware places the current image(s)
information. The information is an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs.
+ May be NULL with a zero ImageInfoSize in order to determine the size of the
+ buffer needed.
@param[out] DescriptorVersion A pointer to the location in which firmware returns the version number
associated with the EFI_FIRMWARE_IMAGE_DESCRIPTOR.
@param[out] DescriptorCount A pointer to the location in which firmware returns the number of
@@ -314,7 +316,12 @@ EFI_STATUS
@retval EFI_SUCCESS The device was successfully updated with the new image.
@retval EFI_BUFFER_TOO_SMALL The ImageInfo buffer was too small. The current buffer size
needed to hold the image(s) information is returned in ImageInfoSize.
- @retval EFI_INVALID_PARAMETER ImageInfoSize is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is not too small and ImageInfo is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorVersion is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorCount is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorSize is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and PackageVersion is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and PackageVersionName is NULL.
@retval EFI_DEVICE_ERROR Valid information could not be returned. Possible corrupted image.
**/
@@ -341,6 +348,9 @@ EFI_STATUS
@param[in] ImageIndex A unique number identifying the firmware image(s) within the device.
The number is between 1 and DescriptorCount.
@param[out] Image Points to the buffer where the current image is copied to.
+ May be NULL with a zero ImageSize in order to determine the size of the
+ buffer needed.
+
@param[in, out] ImageSize On entry, points to the size of the buffer pointed to by Image, in bytes.
On return, points to the length of the image, in bytes.
@@ -348,7 +358,7 @@ EFI_STATUS
@retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to hold the
image. The current buffer size needed to hold the image is returned
in ImageSize.
- @retval EFI_INVALID_PARAMETER The Image was NULL.
+ @retval EFI_INVALID_PARAMETER The ImageSize is not too small and Image is NULL.
@retval EFI_NOT_FOUND The current image is not copied to the buffer.
@retval EFI_UNSUPPORTED The operation is not supported.
@retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.
diff --git a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareCommonDxe.c b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareCommonDxe.c
index 077bd0cb31..6e394d85d4 100644
--- a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareCommonDxe.c
+++ b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareCommonDxe.c
@@ -34,6 +34,8 @@ EFI_FIRMWARE_MANAGEMENT_PROTOCOL mFirmwareManagementProtocol = {
to contain the image(s) information if the buffer was too small.
@param[in, out] ImageInfo A pointer to the buffer in which firmware places the current image(s)
information. The information is an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs.
+ May be NULL with a zero ImageInfoSize in order to determine the size of the
+ buffer needed.
@param[out] DescriptorVersion A pointer to the location in which firmware returns the version number
associated with the EFI_FIRMWARE_IMAGE_DESCRIPTOR.
@param[out] DescriptorCount A pointer to the location in which firmware returns the number of
@@ -54,7 +56,12 @@ EFI_FIRMWARE_MANAGEMENT_PROTOCOL mFirmwareManagementProtocol = {
@retval EFI_SUCCESS The device was successfully updated with the new image.
@retval EFI_BUFFER_TOO_SMALL The ImageInfo buffer was too small. The current buffer size
needed to hold the image(s) information is returned in ImageInfoSize.
- @retval EFI_INVALID_PARAMETER ImageInfoSize is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is not too small and ImageInfo is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorVersion is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorCount is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorSize is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and PackageVersion is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and PackageVersionName is NULL.
@retval EFI_DEVICE_ERROR Valid information could not be returned. Possible corrupted image.
**/
@@ -153,6 +160,8 @@ FmpGetImageInfo (
@param[in] ImageIndex A unique number identifying the firmware image(s) within the device.
The number is between 1 and DescriptorCount.
@param[in,out] Image Points to the buffer where the current image is copied to.
+ May be NULL with a zero ImageSize in order to determine the size of the
+ buffer needed.
@param[in,out] ImageSize On entry, points to the size of the buffer pointed to by Image, in bytes.
On return, points to the length of the image, in bytes.
@@ -160,7 +169,7 @@ FmpGetImageInfo (
@retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to hold the
image. The current buffer size needed to hold the image is returned
in ImageSize.
- @retval EFI_INVALID_PARAMETER The Image was NULL.
+ @retval EFI_INVALID_PARAMETER The ImageSize is not too small and Image is NULL
@retval EFI_NOT_FOUND The current image is not copied to the buffer.
@retval EFI_UNSUPPORTED The operation is not supported.
@retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.
diff --git a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareDxe.h b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareDxe.h
index c8443865cb..b2b2c78318 100644
--- a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareDxe.h
+++ b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareDxe.h
@@ -137,6 +137,8 @@ typedef struct {
to contain the image(s) information if the buffer was too small.
@param[in, out] ImageInfo A pointer to the buffer in which firmware places the current image(s)
information. The information is an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs.
+ May be NULL with a zero ImageInfoSize in order to determine the size of the
+ buffer needed.
@param[out] DescriptorVersion A pointer to the location in which firmware returns the version number
associated with the EFI_FIRMWARE_IMAGE_DESCRIPTOR.
@param[out] DescriptorCount A pointer to the location in which firmware returns the number of
@@ -157,7 +159,12 @@ typedef struct {
@retval EFI_SUCCESS The device was successfully updated with the new image.
@retval EFI_BUFFER_TOO_SMALL The ImageInfo buffer was too small. The current buffer size
needed to hold the image(s) information is returned in ImageInfoSize.
- @retval EFI_INVALID_PARAMETER ImageInfoSize is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is not too small and ImageInfo is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorVersion is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorCount is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorSize is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and PackageVersion is NULL.
+ @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and PackageVersionName is NULL.
@retval EFI_DEVICE_ERROR Valid information could not be returned. Possible corrupted image.
**/
@@ -184,6 +191,8 @@ FmpGetImageInfo (
@param[in] ImageIndex A unique number identifying the firmware image(s) within the device.
The number is between 1 and DescriptorCount.
@param[in,out] Image Points to the buffer where the current image is copied to.
+ May be NULL with a zero ImageSize in order to determine the size of the
+ buffer needed.
@param[in,out] ImageSize On entry, points to the size of the buffer pointed to by Image, in bytes.
On return, points to the length of the image, in bytes.
@@ -191,7 +200,7 @@ FmpGetImageInfo (
@retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to hold the
image. The current buffer size needed to hold the image is returned
in ImageSize.
- @retval EFI_INVALID_PARAMETER The Image was NULL.
+ @retval EFI_INVALID_PARAMETER The ImageSize is not too small and Image is NULL
@retval EFI_NOT_FOUND The current image is not copied to the buffer.
@retval EFI_UNSUPPORTED The operation is not supported.
@retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.
--
2.38.1.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115056): https://edk2.groups.io/g/devel/message/115056
Mute This Topic: https://groups.io/mt/104120132/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [edk2-devel] [PATCH V3] FmpDevicePkg: GetImageInfo Add missing conditions
[not found] ` <DM4PR11MB529554272E24F0A5A4ACDDA499472@DM4PR11MB5295.namprd11.prod.outlook.com>
@ 2024-02-09 21:35 ` Michael D Kinney
0 siblings, 0 replies; 2+ messages in thread
From: Michael D Kinney @ 2024-02-09 21:35 UTC (permalink / raw)
To: Pethaiyan, Madhan, devel@edk2.groups.io
Cc: Liming Gao, Liu, Zhiguang, Li, Yi1, Xu, GuoX, Kinney, Michael D
Hi Madhan,
This single patch changes code in 3 different packages.
Please split into 3 patches with one patch per package.
Thanks,
Mike
> -----Original Message-----
> From: Pethaiyan, Madhan <madhan.pethaiyan@intel.com>
> Sent: Monday, February 5, 2024 12:56 AM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>; Li,
> Yi1 <yi1.li@intel.com>; Xu, GuoX <guox.xu@intel.com>
> Subject: RE: [PATCH V3] FmpDevicePkg: GetImageInfo Add missing
> conditions
>
> Hi all ,
>
> Request everyone to review and provide feedback
>
> Thanks,
> P. Madhan
>
> -----Original Message-----
> From: Pethaiyan, Madhan <madhan.pethaiyan@intel.com>
> Sent: Friday, February 2, 2024 3:31 PM
> To: devel@edk2.groups.io
> Cc: Pethaiyan, Madhan <madhan.pethaiyan@intel.com>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>;
> Liu, Zhiguang <zhiguang.liu@intel.com>; Li, Yi1 <yi1.li@intel.com>; Xu,
> GuoX <guox.xu@intel.com>
> Subject: [PATCH V3] FmpDevicePkg: GetImageInfo Add missing conditions
>
> 1.For EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImage():
> Add the following sentence at the end of the Image parameter
> description. "May be NULL with a zero ImageSize in order to determine
> the size of the buffer needed".
>
> Modify the description of "EFI_INVALID_PARAMETER" return code as "The
> ImageSize is not too small and Image is NULL."
>
> 2.For EFI_FIRMWARE_MANAGEMENT_PROTOCOL.GetImageInfo():
> Add the following sentence at the end of the ImageInfo parameter
> description."May be NULL with a zero ImageInfoSize in order to
> determine the size of the buffer needed".
>
> Modify the description of "EFI_INVALID_PARAMETER" return code as "The
> ImageInfoSize is not too small and Image is NULL." and add new
> descriptions for "EFI_INVALID_PARAMETER" return code.
>
> REF: UEFI spec v2.10 23.1.2
>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Yi Li <yi1.li@intel.com>
> Cc: GuoX Xu <guox.xu@intel.com>
> Signed-off-by: Pethaiyan Madhan <madhan.pethaiyan@intel.com>
> ---
> FmpDevicePkg/FmpDxe/FmpDxe.c | 20 ++++++++++++++-----
> FmpDevicePkg/FmpDxe/FmpDxe.h | 15 +++++++++++---
> MdePkg/Include/Protocol/FirmwareManagement.h | 14 +++++++++++--
> .../SystemFirmwareCommonDxe.c | 13 ++++++++++--
> .../SystemFirmwareUpdate/SystemFirmwareDxe.h | 13 ++++++++++--
> 5 files changed, 61 insertions(+), 14 deletions(-)
>
> diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.c
> b/FmpDevicePkg/FmpDxe/FmpDxe.c index 1e7ec4a09e..1d580c9f69 100644
> --- a/FmpDevicePkg/FmpDxe/FmpDxe.c
> +++ b/FmpDevicePkg/FmpDxe/FmpDxe.c
> @@ -43,7 +43,7 @@ const FIRMWARE_MANAGEMENT_PRIVATE_DATA
> mFirmwareManagementPrivateDataTemplate =
> FIRMWARE_MANAGEMENT_PRIVATE_DATA_SIGNATURE, // Signature
> NULL, // Handle
> { // Fmp
> - GetTheImageInfo,
> + GetImageInfo,
> GetTheImage,
> SetTheImage,
> CheckTheImage,
> @@ -417,6 +417,8 @@ PopulateDescriptor (
> to contain the image(s)
> information if the buffer was too small.
> @param[in, out] ImageInfo A pointer to the buffer in which
> firmware places the current image(s)
> information. The information is
> an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs.
> + May be NULL with a zero
> ImageInfoSize in order to determine the size of the
> + buffer needed.
> @param[out] DescriptorVersion A pointer to the location in
> which firmware returns the version number
> associated with the
> EFI_FIRMWARE_IMAGE_DESCRIPTOR.
> @param[out] DescriptorCount A pointer to the location in
> which firmware returns the number of
> @@ -437,13 +439,18 @@ PopulateDescriptor (
> @retval EFI_SUCCESS The device was successfully
> updated with the new image.
> @retval EFI_BUFFER_TOO_SMALL The ImageInfo buffer was too
> small. The current buffer size
> needed to hold the image(s)
> information is returned in ImageInfoSize.
> - @retval EFI_INVALID_PARAMETER ImageInfoSize is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is not too small
> and ImageInfo is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> DescriptorVersion is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> DescriptorCount is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> DescriptorSize is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> PackageVersion is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> PackageVersionName is NULL.
> @retval EFI_DEVICE_ERROR Valid information could not be
> returned. Possible corrupted image.
>
> **/
> EFI_STATUS
> EFIAPI
> -GetTheImageInfo (
> +GetImageInfo (
> IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,
> IN OUT UINTN *ImageInfoSize,
> IN OUT EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo,
> @@ -495,7 +502,7 @@ GetTheImageInfo (
> // Confirm that buffer isn't null
> //
> if ( (ImageInfo == NULL) || (DescriptorVersion == NULL) ||
> (DescriptorCount == NULL) || (DescriptorSize == NULL)
> - || (PackageVersion == NULL))
> + || (PackageVersion == NULL) || (PackageVersionName == NULL))
> {
> DEBUG ((DEBUG_ERROR, "FmpDxe(%s): GetImageInfo() - Pointer
> Parameter is NULL.\n", mImageIdName));
> Status = EFI_INVALID_PARAMETER;
> @@ -544,6 +551,9 @@ cleanup:
> @param[in] ImageIndex A unique number identifying the
> firmware image(s) within the device.
> The number is between 1 and
> DescriptorCount.
> @param[in, out] Image Points to the buffer where the
> current image is copied to.
> + May be NULL with a zero ImageSize in
> order to determine the size of the
> + buffer needed.
> +
> @param[in, out] ImageSize On entry, points to the size of the
> buffer pointed to by Image, in bytes.
> On return, points to the length of
> the image, in bytes.
>
> @@ -551,7 +561,7 @@ cleanup:
> @retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is
> too small to hold the
> image. The current buffer size needed
> to hold the image is returned
> in ImageSize.
> - @retval EFI_INVALID_PARAMETER The Image was NULL.
> + @retval EFI_INVALID_PARAMETER The ImageSize is not too small and
> + Image is NULL
> @retval EFI_NOT_FOUND The current image is not copied to
> the buffer.
> @retval EFI_UNSUPPORTED The operation is not supported.
> @retval EFI_SECURITY_VIOLATION The operation could not be performed
> due to an authentication failure.
> diff --git a/FmpDevicePkg/FmpDxe/FmpDxe.h
> b/FmpDevicePkg/FmpDxe/FmpDxe.h index 7baf730e69..d2ade143bd 100644
> --- a/FmpDevicePkg/FmpDxe/FmpDxe.h
> +++ b/FmpDevicePkg/FmpDxe/FmpDxe.h
> @@ -114,6 +114,8 @@ DetectTestKey (
> to contain the image(s)
> information if the buffer was too small.
> @param[in, out] ImageInfo A pointer to the buffer in which
> firmware places the current image(s)
> information. The information is
> an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs.
> + May be NULL with a zero
> ImageInfoSize in order to determine the size of the
> + buffer needed.
> @param[out] DescriptorVersion A pointer to the location in
> which firmware returns the version number
> associated with the
> EFI_FIRMWARE_IMAGE_DESCRIPTOR.
> @param[out] DescriptorCount A pointer to the location in
> which firmware returns the number of
> @@ -134,13 +136,18 @@ DetectTestKey (
> @retval EFI_SUCCESS The device was successfully
> updated with the new image.
> @retval EFI_BUFFER_TOO_SMALL The ImageInfo buffer was too
> small. The current buffer size
> needed to hold the image(s)
> information is returned in ImageInfoSize.
> - @retval EFI_INVALID_PARAMETER ImageInfoSize is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is not too small
> and ImageInfo is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> DescriptorVersion is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> DescriptorCount is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> DescriptorSize is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> PackageVersion is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> PackageVersionName is NULL.
> @retval EFI_DEVICE_ERROR Valid information could not be
> returned. Possible corrupted image.
>
> **/
> EFI_STATUS
> EFIAPI
> -GetTheImageInfo (
> +GetImageInfo (
> IN EFI_FIRMWARE_MANAGEMENT_PROTOCOL *This,
> IN OUT UINTN *ImageInfoSize,
> IN OUT EFI_FIRMWARE_IMAGE_DESCRIPTOR *ImageInfo,
> @@ -161,6 +168,8 @@ GetTheImageInfo (
> @param[in] ImageIndex A unique number identifying the
> firmware image(s) within the device.
> The number is between 1 and
> DescriptorCount.
> @param[in, out] Image Points to the buffer where the
> current image is copied to.
> + May be NULL with a zero ImageSize in
> order to determine the size of the
> + buffer needed.
> @param[in, out] ImageSize On entry, points to the size of the
> buffer pointed to by Image, in bytes.
> On return, points to the length of
> the image, in bytes.
>
> @@ -168,7 +177,7 @@ GetTheImageInfo (
> @retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is
> too small to hold the
> image. The current buffer size needed
> to hold the image is returned
> in ImageSize.
> - @retval EFI_INVALID_PARAMETER The Image was NULL.
> + @retval EFI_INVALID_PARAMETER The ImageSize is not too small and
> + Image is NULL
> @retval EFI_NOT_FOUND The current image is not copied to
> the buffer.
> @retval EFI_UNSUPPORTED The operation is not supported.
> @retval EFI_SECURITY_VIOLATION The operation could not be performed
> due to an authentication failure.
> diff --git a/MdePkg/Include/Protocol/FirmwareManagement.h
> b/MdePkg/Include/Protocol/FirmwareManagement.h
> index e535bb697d..90b7d83c8f 100644
> --- a/MdePkg/Include/Protocol/FirmwareManagement.h
> +++ b/MdePkg/Include/Protocol/FirmwareManagement.h
> @@ -294,6 +294,8 @@ EFI_STATUS
> to contain the image(s)
> information if the buffer was too small.
> @param[in, out] ImageInfo A pointer to the buffer in which
> firmware places the current image(s)
> information. The information is
> an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs.
> + May be NULL with a zero
> ImageInfoSize in order to determine the size of the
> + buffer needed.
> @param[out] DescriptorVersion A pointer to the location in
> which firmware returns the version number
> associated with the
> EFI_FIRMWARE_IMAGE_DESCRIPTOR.
> @param[out] DescriptorCount A pointer to the location in
> which firmware returns the number of
> @@ -314,7 +316,12 @@ EFI_STATUS
> @retval EFI_SUCCESS The device was successfully
> updated with the new image.
> @retval EFI_BUFFER_TOO_SMALL The ImageInfo buffer was too
> small. The current buffer size
> needed to hold the image(s)
> information is returned in ImageInfoSize.
> - @retval EFI_INVALID_PARAMETER ImageInfoSize is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is not too small
> and ImageInfo is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> DescriptorVersion is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> DescriptorCount is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> DescriptorSize is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> PackageVersion is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> PackageVersionName is NULL.
> @retval EFI_DEVICE_ERROR Valid information could not be
> returned. Possible corrupted image.
>
> **/
> @@ -341,6 +348,9 @@ EFI_STATUS
> @param[in] ImageIndex A unique number identifying the
> firmware image(s) within the device.
> The number is between 1 and
> DescriptorCount.
> @param[out] Image Points to the buffer where the
> current image is copied to.
> + May be NULL with a zero ImageSize in
> order to determine the size of the
> + buffer needed.
> +
> @param[in, out] ImageSize On entry, points to the size of the
> buffer pointed to by Image, in bytes.
> On return, points to the length of
> the image, in bytes.
>
> @@ -348,7 +358,7 @@ EFI_STATUS
> @retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is
> too small to hold the
> image. The current buffer size needed
> to hold the image is returned
> in ImageSize.
> - @retval EFI_INVALID_PARAMETER The Image was NULL.
> + @retval EFI_INVALID_PARAMETER The ImageSize is not too small and
> Image is NULL.
> @retval EFI_NOT_FOUND The current image is not copied to
> the buffer.
> @retval EFI_UNSUPPORTED The operation is not supported.
> @retval EFI_SECURITY_VIOLATION The operation could not be performed
> due to an authentication failure.
> diff --git
> a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareCommonD
> xe.c
> b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareCommonD
> xe.c
> index 077bd0cb31..6e394d85d4 100644
> ---
> a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareCommonD
> xe.c
> +++
> b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareComm
> +++ onDxe.c
> @@ -34,6 +34,8 @@ EFI_FIRMWARE_MANAGEMENT_PROTOCOL
> mFirmwareManagementProtocol = {
> to contain the image(s)
> information if the buffer was too small.
> @param[in, out] ImageInfo A pointer to the buffer in which
> firmware places the current image(s)
> information. The information is
> an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs.
> + May be NULL with a zero
> ImageInfoSize in order to determine the size of the
> + buffer needed.
> @param[out] DescriptorVersion A pointer to the location in
> which firmware returns the version number
> associated with the
> EFI_FIRMWARE_IMAGE_DESCRIPTOR.
> @param[out] DescriptorCount A pointer to the location in
> which firmware returns the number of
> @@ -54,7 +56,12 @@ EFI_FIRMWARE_MANAGEMENT_PROTOCOL
> mFirmwareManagementProtocol = {
> @retval EFI_SUCCESS The device was successfully
> updated with the new image.
> @retval EFI_BUFFER_TOO_SMALL The ImageInfo buffer was too
> small. The current buffer size
> needed to hold the image(s)
> information is returned in ImageInfoSize.
> - @retval EFI_INVALID_PARAMETER ImageInfoSize is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is not too small
> and ImageInfo is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> DescriptorVersion is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> DescriptorCount is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> DescriptorSize is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> PackageVersion is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> PackageVersionName is NULL.
> @retval EFI_DEVICE_ERROR Valid information could not be
> returned. Possible corrupted image.
>
> **/
> @@ -153,6 +160,8 @@ FmpGetImageInfo (
> @param[in] ImageIndex A unique number identifying the
> firmware image(s) within the device.
> The number is between 1 and
> DescriptorCount.
> @param[in,out] Image Points to the buffer where the
> current image is copied to.
> + May be NULL with a zero ImageSize in
> order to determine the size of the
> + buffer needed.
> @param[in,out] ImageSize On entry, points to the size of the
> buffer pointed to by Image, in bytes.
> On return, points to the length of
> the image, in bytes.
>
> @@ -160,7 +169,7 @@ FmpGetImageInfo (
> @retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is
> too small to hold the
> image. The current buffer size needed
> to hold the image is returned
> in ImageSize.
> - @retval EFI_INVALID_PARAMETER The Image was NULL.
> + @retval EFI_INVALID_PARAMETER The ImageSize is not too small and
> + Image is NULL
> @retval EFI_NOT_FOUND The current image is not copied to
> the buffer.
> @retval EFI_UNSUPPORTED The operation is not supported.
> @retval EFI_SECURITY_VIOLATION The operation could not be performed
> due to an authentication failure.
> diff --git
> a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareDxe.h
> b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareDxe.h
> index c8443865cb..b2b2c78318 100644
> ---
> a/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareDxe.h
> +++
> b/SignedCapsulePkg/Universal/SystemFirmwareUpdate/SystemFirmwareDxe.
> +++ h
> @@ -137,6 +137,8 @@ typedef struct {
> to contain the image(s)
> information if the buffer was too small.
> @param[in, out] ImageInfo A pointer to the buffer in which
> firmware places the current image(s)
> information. The information is
> an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs.
> + May be NULL with a zero
> ImageInfoSize in order to determine the size of the
> + buffer needed.
> @param[out] DescriptorVersion A pointer to the location in
> which firmware returns the version number
> associated with the
> EFI_FIRMWARE_IMAGE_DESCRIPTOR.
> @param[out] DescriptorCount A pointer to the location in
> which firmware returns the number of
> @@ -157,7 +159,12 @@ typedef struct {
> @retval EFI_SUCCESS The device was successfully
> updated with the new image.
> @retval EFI_BUFFER_TOO_SMALL The ImageInfo buffer was too
> small. The current buffer size
> needed to hold the image(s)
> information is returned in ImageInfoSize.
> - @retval EFI_INVALID_PARAMETER ImageInfoSize is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is not too small
> and ImageInfo is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> DescriptorVersion is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> DescriptorCount is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> DescriptorSize is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> PackageVersion is NULL.
> + @retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and
> PackageVersionName is NULL.
> @retval EFI_DEVICE_ERROR Valid information could not be
> returned. Possible corrupted image.
>
> **/
> @@ -184,6 +191,8 @@ FmpGetImageInfo (
> @param[in] ImageIndex A unique number identifying the
> firmware image(s) within the device.
> The number is between 1 and
> DescriptorCount.
> @param[in,out] Image Points to the buffer where the
> current image is copied to.
> + May be NULL with a zero ImageSize in
> order to determine the size of the
> + buffer needed.
> @param[in,out] ImageSize On entry, points to the size of the
> buffer pointed to by Image, in bytes.
> On return, points to the length of
> the image, in bytes.
>
> @@ -191,7 +200,7 @@ FmpGetImageInfo (
> @retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is
> too small to hold the
> image. The current buffer size needed
> to hold the image is returned
> in ImageSize.
> - @retval EFI_INVALID_PARAMETER The Image was NULL.
> + @retval EFI_INVALID_PARAMETER The ImageSize is not too small and
> + Image is NULL
> @retval EFI_NOT_FOUND The current image is not copied to
> the buffer.
> @retval EFI_UNSUPPORTED The operation is not supported.
> @retval EFI_SECURITY_VIOLATION The operation could not be performed
> due to an authentication failure.
> --
> 2.38.1.windows.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115332): https://edk2.groups.io/g/devel/message/115332
Mute This Topic: https://groups.io/mt/104120132/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-09 21:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-02 10:00 [edk2-devel] [PATCH V3] FmpDevicePkg: GetImageInfo Add missing conditions Pethaiyan Madhan
[not found] ` <DM4PR11MB529554272E24F0A5A4ACDDA499472@DM4PR11MB5295.namprd11.prod.outlook.com>
2024-02-09 21:35 ` Michael D Kinney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox