[edk2] [PATCH] IntelSiliconPkg MicrocodeUpdateDxe: Fix (ExtendedTableLength & 0x3)!=0

Star Zeng posted 1 patch 6 years, 4 months ago
Failed in applying to current master (apply log)
IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[edk2] [PATCH] IntelSiliconPkg MicrocodeUpdateDxe: Fix (ExtendedTableLength & 0x3)!=0
Posted by Star Zeng 6 years, 4 months ago
The first 48 bytes contain the microcode update header.
DataSize must be a multiple of DWORDs.
TotalSize is always a multiple of 1024.
Both size of CPU_MICROCODE_EXTENDED_TABLE_HEADER and
CPU_MICROCODE_EXTENDED_TABLE are multiple of DWORDs.

So (ExtendedTableLength & 0x3)!=0 should be
(ExtendedTableLength & 0x3)==0.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c b/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
index 4e8f1d5fd8a8..b99221c9696d 100644
--- a/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
+++ b/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
@@ -8,7 +8,7 @@
 
   MicrocodeWrite() and VerifyMicrocode() will receive untrusted input and do basic validation.
 
-  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD License
   which accompanies this distribution.  The full text of the license may be found at
@@ -494,7 +494,7 @@ VerifyMicrocode (
       //
       // Calculate Extended Checksum
       //
-      if ((ExtendedTableLength > sizeof(CPU_MICROCODE_EXTENDED_TABLE_HEADER)) && ((ExtendedTableLength & 0x3) != 0)) {
+      if ((ExtendedTableLength > sizeof(CPU_MICROCODE_EXTENDED_TABLE_HEADER)) && ((ExtendedTableLength & 0x3) == 0)) {
         CheckSum32 = CalculateSum32((UINT32 *)ExtendedTableHeader, ExtendedTableLength);
         if (CheckSum32 == 0) {
           //
-- 
2.7.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] IntelSiliconPkg MicrocodeUpdateDxe: Fix (ExtendedTableLength & 0x3)!=0
Posted by Yao, Jiewen 6 years, 4 months ago
Reviewed-by: Jiewen.yao@intel.com

> -----Original Message-----
> From: Zeng, Star
> Sent: Thursday, December 21, 2017 10:35 AM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>;
> Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>
> Subject: [PATCH] IntelSiliconPkg MicrocodeUpdateDxe: Fix (ExtendedTableLength
> & 0x3)!=0
> 
> The first 48 bytes contain the microcode update header.
> DataSize must be a multiple of DWORDs.
> TotalSize is always a multiple of 1024.
> Both size of CPU_MICROCODE_EXTENDED_TABLE_HEADER and
> CPU_MICROCODE_EXTENDED_TABLE are multiple of DWORDs.
> 
> So (ExtendedTableLength & 0x3)!=0 should be
> (ExtendedTableLength & 0x3)==0.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c | 4
> ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git
> a/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
> b/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
> index 4e8f1d5fd8a8..b99221c9696d 100644
> --- a/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
> +++
> b/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
> @@ -8,7 +8,7 @@
> 
>    MicrocodeWrite() and VerifyMicrocode() will receive untrusted input and do
> basic validation.
> 
> -  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of the BSD
> License
>    which accompanies this distribution.  The full text of the license may be
> found at
> @@ -494,7 +494,7 @@ VerifyMicrocode (
>        //
>        // Calculate Extended Checksum
>        //
> -      if ((ExtendedTableLength >
> sizeof(CPU_MICROCODE_EXTENDED_TABLE_HEADER)) &&
> ((ExtendedTableLength & 0x3) != 0)) {
> +      if ((ExtendedTableLength >
> sizeof(CPU_MICROCODE_EXTENDED_TABLE_HEADER)) &&
> ((ExtendedTableLength & 0x3) == 0)) {
>          CheckSum32 = CalculateSum32((UINT32 *)ExtendedTableHeader,
> ExtendedTableLength);
>          if (CheckSum32 == 0) {
>            //
> --
> 2.7.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [PATCH] IntelSiliconPkg MicrocodeUpdateDxe: Fix (ExtendedTableLength & 0x3)!=0
Posted by Chaganty, Rangasai V 6 years, 4 months ago
Reviewed-by: rangasai.v.chaganty@intel.com 

-----Original Message-----
From: Yao, Jiewen 
Sent: Wednesday, December 20, 2017 7:09 PM
To: Zeng, Star <star.zeng@intel.com>; edk2-devel@lists.01.org
Cc: Chaganty, Rangasai V <rangasai.v.chaganty@intel.com>
Subject: RE: [PATCH] IntelSiliconPkg MicrocodeUpdateDxe: Fix (ExtendedTableLength & 0x3)!=0

Reviewed-by: Jiewen.yao@intel.com

> -----Original Message-----
> From: Zeng, Star
> Sent: Thursday, December 21, 2017 10:35 AM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>; Yao, Jiewen 
> <jiewen.yao@intel.com>; Chaganty, Rangasai V 
> <rangasai.v.chaganty@intel.com>
> Subject: [PATCH] IntelSiliconPkg MicrocodeUpdateDxe: Fix 
> (ExtendedTableLength & 0x3)!=0
> 
> The first 48 bytes contain the microcode update header.
> DataSize must be a multiple of DWORDs.
> TotalSize is always a multiple of 1024.
> Both size of CPU_MICROCODE_EXTENDED_TABLE_HEADER and 
> CPU_MICROCODE_EXTENDED_TABLE are multiple of DWORDs.
> 
> So (ExtendedTableLength & 0x3)!=0 should be (ExtendedTableLength & 
> 0x3)==0.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c 
> | 4
> ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git
> a/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
> b/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
> index 4e8f1d5fd8a8..b99221c9696d 100644
> --- 
> a/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
> +++
> b/IntelSiliconPkg/Feature/Capsule/MicrocodeUpdateDxe/MicrocodeUpdate.c
> @@ -8,7 +8,7 @@
> 
>    MicrocodeWrite() and VerifyMicrocode() will receive untrusted input 
> and do basic validation.
> 
> -  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
> +  Copyright (c) 2016 - 2017, Intel Corporation. All rights 
> + reserved.<BR>
>    This program and the accompanying materials
>    are licensed and made available under the terms and conditions of 
> the BSD License
>    which accompanies this distribution.  The full text of the license 
> may be found at @@ -494,7 +494,7 @@ VerifyMicrocode (
>        //
>        // Calculate Extended Checksum
>        //
> -      if ((ExtendedTableLength >
> sizeof(CPU_MICROCODE_EXTENDED_TABLE_HEADER)) && ((ExtendedTableLength 
> & 0x3) != 0)) {
> +      if ((ExtendedTableLength >
> sizeof(CPU_MICROCODE_EXTENDED_TABLE_HEADER)) && ((ExtendedTableLength 
> & 0x3) == 0)) {
>          CheckSum32 = CalculateSum32((UINT32 *)ExtendedTableHeader, 
> ExtendedTableLength);
>          if (CheckSum32 == 0) {
>            //
> --
> 2.7.0.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel