Skip to content

Commit cb8c8c9

Browse files
MadhanPethaiyanmergify[bot]
authored andcommitted
FmpDevicePkg: GetImageInfo Add missing conditions
REF: UEFI spec v2.10 23.1.2 REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4660 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. Cc: Michael D Kinney <[email protected]> Cc: Liming Gao <[email protected]> Cc: Zhiguang Liu <[email protected]> Cc: Yi Li <[email protected]> Signed-off-by: Pethaiyan Madhan <[email protected]>
1 parent 641bd54 commit cb8c8c9

File tree

2 files changed

+50
-31
lines changed

2 files changed

+50
-31
lines changed

FmpDevicePkg/FmpDxe/FmpDxe.c

Lines changed: 39 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -51,38 +51,38 @@ const FIRMWARE_MANAGEMENT_PRIVATE_DATA mFirmwareManagementPrivateDataTemplate =
5151
SetPackageInfo
5252
},
5353
FALSE, // DescriptorPopulated
54-
{ // Desc
55-
1, // ImageIndex
54+
{ // Desc
55+
1, // ImageIndex
5656
//
5757
// ImageTypeId
5858
//
5959
{ 0x00000000, 0x0000,0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
6060
},
61-
1, // ImageId
62-
NULL, // ImageIdName
63-
0, // Version
64-
NULL, // VersionName
65-
0, // Size
66-
0, // AttributesSupported
67-
0, // AttributesSetting
68-
0, // Compatibilities
69-
0, // LowestSupportedImageVersion
70-
0, // LastAttemptVersion
71-
0, // LastAttemptStatus
72-
0 // HardwareInstance
61+
1, // ImageId
62+
NULL, // ImageIdName
63+
0, // Version
64+
NULL, // VersionName
65+
0, // Size
66+
0, // AttributesSupported
67+
0, // AttributesSetting
68+
0, // Compatibilities
69+
0, // LowestSupportedImageVersion
70+
0, // LastAttemptVersion
71+
0, // LastAttemptStatus
72+
0 // HardwareInstance
7373
},
74-
NULL, // ImageIdName
75-
NULL, // VersionName
76-
TRUE, // RuntimeVersionSupported
77-
NULL, // FmpDeviceLockEvent
78-
FALSE, // FmpDeviceLocked
79-
NULL, // FmpDeviceContext
80-
NULL, // VersionVariableName
81-
NULL, // LsvVariableName
82-
NULL, // LastAttemptStatusVariableName
83-
NULL, // LastAttemptVersionVariableName
84-
NULL, // FmpStateVariableName
85-
TRUE // DependenciesSatisfied
74+
NULL, // ImageIdName
75+
NULL, // VersionName
76+
TRUE, // RuntimeVersionSupported
77+
NULL, // FmpDeviceLockEvent
78+
FALSE, // FmpDeviceLocked
79+
NULL, // FmpDeviceContext
80+
NULL, // VersionVariableName
81+
NULL, // LsvVariableName
82+
NULL, // LastAttemptStatusVariableName
83+
NULL, // LastAttemptVersionVariableName
84+
NULL, // FmpStateVariableName
85+
TRUE // DependenciesSatisfied
8686
};
8787

8888
///
@@ -422,6 +422,8 @@ PopulateDescriptor (
422422
to contain the image(s) information if the buffer was too small.
423423
@param[in, out] ImageInfo A pointer to the buffer in which firmware places the current image(s)
424424
information. The information is an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs.
425+
May be NULL with a zero ImageInfoSize in order to determine the size of the
426+
buffer needed.
425427
@param[out] DescriptorVersion A pointer to the location in which firmware returns the version number
426428
associated with the EFI_FIRMWARE_IMAGE_DESCRIPTOR.
427429
@param[out] DescriptorCount A pointer to the location in which firmware returns the number of
@@ -442,7 +444,13 @@ PopulateDescriptor (
442444
@retval EFI_SUCCESS The device was successfully updated with the new image.
443445
@retval EFI_BUFFER_TOO_SMALL The ImageInfo buffer was too small. The current buffer size
444446
needed to hold the image(s) information is returned in ImageInfoSize.
445-
@retval EFI_INVALID_PARAMETER ImageInfoSize is NULL.
447+
@retval EFI_INVALID_PARAMETER ImageInfoSize is not too small and ImageInfo is NULL.
448+
@retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorVersion is NULL.
449+
@retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorCount is NULL.
450+
@retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorSize is NULL.
451+
@retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and PackageVersion is NULL.
452+
@retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and PackageVersionName is NULL.
453+
446454
@retval EFI_DEVICE_ERROR Valid information could not be returned. Possible corrupted image.
447455
448456
**/
@@ -500,7 +508,7 @@ GetTheImageInfo (
500508
// Confirm that buffer isn't null
501509
//
502510
if ( (ImageInfo == NULL) || (DescriptorVersion == NULL) || (DescriptorCount == NULL) || (DescriptorSize == NULL)
503-
|| (PackageVersion == NULL))
511+
|| (PackageVersion == NULL) || (PackageVersionName == NULL))
504512
{
505513
DEBUG ((DEBUG_ERROR, "FmpDxe(%s): GetImageInfo() - Pointer Parameter is NULL.\n", mImageIdName));
506514
Status = EFI_INVALID_PARAMETER;
@@ -549,14 +557,16 @@ GetTheImageInfo (
549557
@param[in] ImageIndex A unique number identifying the firmware image(s) within the device.
550558
The number is between 1 and DescriptorCount.
551559
@param[in, out] Image Points to the buffer where the current image is copied to.
560+
May be NULL with a zero ImageSize in order to determine the size of the
561+
buffer needed.
552562
@param[in, out] ImageSize On entry, points to the size of the buffer pointed to by Image, in bytes.
553563
On return, points to the length of the image, in bytes.
554564
555565
@retval EFI_SUCCESS The device was successfully updated with the new image.
556566
@retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to hold the
557567
image. The current buffer size needed to hold the image is returned
558568
in ImageSize.
559-
@retval EFI_INVALID_PARAMETER The Image was NULL.
569+
@retval EFI_INVALID_PARAMETER The ImageSize is not too small and Image is NULL.
560570
@retval EFI_NOT_FOUND The current image is not copied to the buffer.
561571
@retval EFI_UNSUPPORTED The operation is not supported.
562572
@retval EFI_SECURITY_VIOLATION The operation could not be completed due to an image corruption.

FmpDevicePkg/FmpDxe/FmpDxe.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ DetectTestKey (
114114
to contain the image(s) information if the buffer was too small.
115115
@param[in, out] ImageInfo A pointer to the buffer in which firmware places the current image(s)
116116
information. The information is an array of EFI_FIRMWARE_IMAGE_DESCRIPTORs.
117+
May be NULL with a zero ImageInfoSize in order to determine the size of the
118+
buffer needed.
117119
@param[out] DescriptorVersion A pointer to the location in which firmware returns the version number
118120
associated with the EFI_FIRMWARE_IMAGE_DESCRIPTOR.
119121
@param[out] DescriptorCount A pointer to the location in which firmware returns the number of
@@ -134,7 +136,12 @@ DetectTestKey (
134136
@retval EFI_SUCCESS The device was successfully updated with the new image.
135137
@retval EFI_BUFFER_TOO_SMALL The ImageInfo buffer was too small. The current buffer size
136138
needed to hold the image(s) information is returned in ImageInfoSize.
137-
@retval EFI_INVALID_PARAMETER ImageInfoSize is NULL.
139+
@retval EFI_INVALID_PARAMETER ImageInfoSize is not too small and ImageInfo is NULL.
140+
@retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorVersion is NULL.
141+
@retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorCount is NULL.
142+
@retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and DescriptorSize is NULL.
143+
@retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and PackageVersion is NULL.
144+
@retval EFI_INVALID_PARAMETER ImageInfoSize is non-zero and PackageVersionName is NULL.
138145
@retval EFI_DEVICE_ERROR Valid information could not be returned. Possible corrupted image.
139146
140147
**/
@@ -161,14 +168,16 @@ GetTheImageInfo (
161168
@param[in] ImageIndex A unique number identifying the firmware image(s) within the device.
162169
The number is between 1 and DescriptorCount.
163170
@param[in, out] Image Points to the buffer where the current image is copied to.
171+
May be NULL with a zero ImageSize in order to determine the size of the
172+
buffer needed.
164173
@param[in, out] ImageSize On entry, points to the size of the buffer pointed to by Image, in bytes.
165174
On return, points to the length of the image, in bytes.
166175
167176
@retval EFI_SUCCESS The device was successfully updated with the new image.
168177
@retval EFI_BUFFER_TOO_SMALL The buffer specified by ImageSize is too small to hold the
169178
image. The current buffer size needed to hold the image is returned
170179
in ImageSize.
171-
@retval EFI_INVALID_PARAMETER The Image was NULL.
180+
@retval EFI_INVALID_PARAMETER The ImageSize is not too small and Image is NULL.
172181
@retval EFI_NOT_FOUND The current image is not copied to the buffer.
173182
@retval EFI_UNSUPPORTED The operation is not supported.
174183
@retval EFI_SECURITY_VIOLATION The operation could not be performed due to an authentication failure.

0 commit comments

Comments
 (0)