diff options
Diffstat (limited to 'MdePkg')
-rw-r--r-- | MdePkg/Include/Ppi/Pcd.h | 14 | ||||
-rw-r--r-- | MdePkg/Include/Protocol/Pcd.h | 16 | ||||
-rw-r--r-- | MdePkg/Library/BasePcdLibNull/PcdLib.c | 2 | ||||
-rw-r--r-- | MdePkg/Library/DxePcdLib/DxePcdLib.c | 24 | ||||
-rw-r--r-- | MdePkg/Library/PeiPcdLib/PeiPcdLib.c | 23 |
5 files changed, 30 insertions, 49 deletions
diff --git a/MdePkg/Include/Ppi/Pcd.h b/MdePkg/Include/Ppi/Pcd.h index a67e79c01c..2050d659de 100644 --- a/MdePkg/Include/Ppi/Pcd.h +++ b/MdePkg/Include/Ppi/Pcd.h @@ -152,9 +152,9 @@ EFI_STATUS typedef
EFI_STATUS
(EFIAPI *PCD_PPI_SET_POINTER) (
- IN UINTN TokenNumber,
- IN UINTN SizeOfBuffer,
- IN VOID *Buffer
+ IN UINTN TokenNumber,
+ IN OUT UINTN *SizeOfBuffer,
+ IN VOID *Buffer
);
typedef
@@ -199,10 +199,10 @@ EFI_STATUS typedef
EFI_STATUS
(EFIAPI *PCD_PPI_SET_EX_POINTER) (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber,
- IN UINTN SizeOfBuffer,
- IN VOID *Buffer
+ IN CONST EFI_GUID *Guid,
+ IN UINTN TokenNumber,
+ IN OUT UINTN *SizeOfBuffer,
+ IN VOID *Buffer
);
typedef
diff --git a/MdePkg/Include/Protocol/Pcd.h b/MdePkg/Include/Protocol/Pcd.h index 8869ad2be1..4127f73488 100644 --- a/MdePkg/Include/Protocol/Pcd.h +++ b/MdePkg/Include/Protocol/Pcd.h @@ -152,9 +152,9 @@ EFI_STATUS typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET_POINTER) (
- IN UINTN TokenNumber,
- IN UINTN SizeOfBuffer,
- IN VOID *Buffer
+ IN UINTN TokenNumber,
+ IN OUT UINTN *SizeOfBuffer,
+ IN VOID *Buffer
);
typedef
@@ -199,10 +199,10 @@ EFI_STATUS typedef
EFI_STATUS
(EFIAPI *PCD_PROTOCOL_SET_EX_POINTER) (
- IN CONST EFI_GUID *Guid,
- IN UINTN TokenNumber,
- IN UINTN SizeOfBuffer,
- IN VOID *Buffer
+ IN CONST EFI_GUID *Guid,
+ IN UINTN TokenNumber,
+ IN OUT UINTN *SizeOfBuffer,
+ IN VOID *Buffer
);
typedef
@@ -228,7 +228,7 @@ typedef VOID
(EFIAPI *PCD_PROTOCOL_CALLBACK) (
IN CONST EFI_GUID *CallBackGuid, OPTIONAL
- IN UINTN CallBackToken,
+ IN UINTN CallBackToken,
IN OUT VOID *TokenData,
IN UINTN TokenDataSize
);
diff --git a/MdePkg/Library/BasePcdLibNull/PcdLib.c b/MdePkg/Library/BasePcdLibNull/PcdLib.c index e58965cc68..ab6f711a00 100644 --- a/MdePkg/Library/BasePcdLibNull/PcdLib.c +++ b/MdePkg/Library/BasePcdLibNull/PcdLib.c @@ -463,6 +463,8 @@ LibPcdSetPtr ( IN VOID *Buffer
)
{
+ ASSERT (SizeOfBuffer != NULL);
+
if (*SizeOfBuffer > 0) {
ASSERT (Buffer != NULL);
}
diff --git a/MdePkg/Library/DxePcdLib/DxePcdLib.c b/MdePkg/Library/DxePcdLib/DxePcdLib.c index f0b0cbd8f6..2747df35c0 100644 --- a/MdePkg/Library/DxePcdLib/DxePcdLib.c +++ b/MdePkg/Library/DxePcdLib/DxePcdLib.c @@ -514,23 +514,19 @@ LibPcdSetPtr ( )
{
EFI_STATUS Status;
- UINTN Size;
+
+ ASSERT (SizeOfBuffer != NULL);
if (*SizeOfBuffer > 0) {
ASSERT (Buffer != NULL);
}
- Size = LibPcdGetSize (TokenNumber);
-
- if (*SizeOfBuffer > Size) {
- *SizeOfBuffer = Size;
+ Status = mPcd->SetPtr (TokenNumber, SizeOfBuffer, Buffer);
+
+ if (EFI_ERROR (Status)) {
return NULL;
}
- Status = mPcd->SetPtr (TokenNumber, *SizeOfBuffer, Buffer);
-
- ASSERT_EFI_ERROR (Status);
-
return Buffer;
}
@@ -728,7 +724,6 @@ LibPcdSetExPtr ( )
{
EFI_STATUS Status;
- UINTN Size;
ASSERT (Guid != NULL);
@@ -738,17 +733,12 @@ LibPcdSetExPtr ( ASSERT (Buffer != NULL);
}
+ Status = mPcd->SetPtrEx (Guid, TokenNumber, SizeOfBuffer, Buffer);
- Size = LibPcdGetExSize (Guid, TokenNumber);
- if (*SizeOfBuffer > Size) {
- *SizeOfBuffer = Size;
+ if (EFI_ERROR (Status)) {
return NULL;
}
- Status = mPcd->SetPtrEx (Guid, TokenNumber, *SizeOfBuffer, Buffer);
-
- ASSERT_EFI_ERROR (Status);
-
return Buffer;
}
diff --git a/MdePkg/Library/PeiPcdLib/PeiPcdLib.c b/MdePkg/Library/PeiPcdLib/PeiPcdLib.c index bee5386097..b8a53185bd 100644 --- a/MdePkg/Library/PeiPcdLib/PeiPcdLib.c +++ b/MdePkg/Library/PeiPcdLib/PeiPcdLib.c @@ -586,7 +586,6 @@ LibPcdSetPtr ( {
EFI_STATUS Status;
PCD_PPI *PcdPpi;
- UINTN Size;
ASSERT (SizeOfBuffer != NULL);
@@ -596,17 +595,12 @@ LibPcdSetPtr ( PcdPpi = GetPcdPpiPtr ();
- Size = LibPcdGetSize (TokenNumber);
-
- if (*SizeOfBuffer > Size) {
- *SizeOfBuffer = Size;
+ Status = PcdPpi->SetPtr (TokenNumber, SizeOfBuffer, Buffer);
+
+ if (EFI_ERROR (Status)) {
return NULL;
}
- Status = PcdPpi->SetPtr (TokenNumber, *SizeOfBuffer, Buffer);
-
- ASSERT_EFI_ERROR (Status);
-
return Buffer;
}
@@ -817,7 +811,6 @@ LibPcdSetExPtr ( {
EFI_STATUS Status;
PCD_PPI *PcdPpi;
- UINTN Size;
if (*SizeOfBuffer > 0) {
ASSERT (Buffer != NULL);
@@ -825,16 +818,12 @@ LibPcdSetExPtr ( PcdPpi = GetPcdPpiPtr ();
- Size = LibPcdGetExSize (Guid, TokenNumber);
- if (*SizeOfBuffer > Size) {
- *SizeOfBuffer = Size;
+ Status = PcdPpi->SetPtrEx (Guid, TokenNumber, SizeOfBuffer, Buffer);
+
+ if (EFI_ERROR (Status)) {
return NULL;
}
- Status = PcdPpi->SetPtrEx (Guid, TokenNumber, *SizeOfBuffer, Buffer);
-
- ASSERT_EFI_ERROR (Status);
-
return Buffer;
}
|