[edk2-devel] [patch] ShellPkg/Debug1CommandsLib: Fix bugs in func DisplaySysEventLogData

Dandan Bi posted 1 patch 4 years, 11 months ago
Failed in applying to current master (apply log)
.../SmbiosView/EventLogInfo.c                 | 20 +++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
[edk2-devel] [patch] ShellPkg/Debug1CommandsLib: Fix bugs in func DisplaySysEventLogData
Posted by Dandan Bi 4 years, 11 months ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1498

This patch fix following bugs in func DisplaySysEventLogData:
1. Log increment (Log = (LOG_RECORD_FORMAT *) (LogData + Offset);)
should happened in the end of while loop, not in the very beginning.
2. DisplaySELTypes function should be used in while loop instead of
DisplaySELVarDataFormatType.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 .../SmbiosView/EventLogInfo.c                 | 20 +++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.c
index b8adf438d3..984c178890 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInfo.c
@@ -1,9 +1,9 @@
 /** @file
   Module for clarifying the content of the smbios structure element info.
 
-  Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>
+  Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved. <BR>
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
 
 #include "UefiShellDebug1CommandsLib.h"
@@ -345,20 +345,16 @@ DisplaySysEventLogData (
   // Print Log info
   //
   Offset  = 0;
   Log     = (LOG_RECORD_FORMAT *) LogData;
   while (Log != NULL && Log->Type != END_OF_LOG && Offset < LogAreaLength) {
-    //
-    // Get a Event Log Record
-    //
-    Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
 
     if (Log != NULL) {
       //
       // Display Event Log Record Information
       //
-      DisplaySELVarDataFormatType (Log->Type, SHOW_DETAIL);
+      DisplaySELTypes (Log->Type, SHOW_DETAIL);
       DisplaySELLogHeaderLen (Log->Length, SHOW_DETAIL);
 
       Offset += Log->Length;
       //
       // Display Log Header Date/Time Fields
@@ -371,10 +367,14 @@ DisplaySysEventLogData (
         Print (L"19");
       } else if (Log != NULL && Log->Year <= 79) {
         Print (L"20");
       } else {
         ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ERROR), gShellDebug1HiiHandle);
+        //
+        // Get a Event Log Record
+        //
+        Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
         continue;
       }
 
       ShellPrintHiiEx(-1,-1,NULL,
         STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TIME_SIX_VARS),
@@ -389,13 +389,21 @@ DisplaySysEventLogData (
 
       //
       // Display Variable Data Format
       //
       if (Log->Length <= (sizeof (LOG_RECORD_FORMAT) - 1)) {
+        //
+        // Get a Event Log Record
+        //
+        Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
         continue;
       }
 
       ElVdfType = Log->LogVariableData[0];
       DisplayElVdfInfo (ElVdfType, Log->LogVariableData);
+      //
+      // Get a Event Log Record
+      //
+      Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
     }
   }
 }
-- 
2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#41441): https://edk2.groups.io/g/devel/message/41441
Mute This Topic: https://groups.io/mt/31816865/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [patch] ShellPkg/Debug1CommandsLib: Fix bugs in func DisplaySysEventLogData
Posted by Gao, Zhichao 4 years, 11 months ago
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>

> -----Original Message-----
> From: Bi, Dandan
> Sent: Tuesday, May 28, 2019 10:25 AM
> To: devel@edk2.groups.io; oleksiyy@ami.com
> Cc: Carsey, Jaben <jaben.carsey@intel.com>; Ni, Ray <ray.ni@intel.com>;
> Gao, Zhichao <zhichao.gao@intel.com>
> Subject: [patch] ShellPkg/Debug1CommandsLib: Fix bugs in func
> DisplaySysEventLogData
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1498
> 
> This patch fix following bugs in func DisplaySysEventLogData:
> 1. Log increment (Log = (LOG_RECORD_FORMAT *) (LogData + Offset);)
> should happened in the end of while loop, not in the very beginning.
> 2. DisplaySELTypes function should be used in while loop instead of
> DisplaySELVarDataFormatType.
> 
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Zhichao Gao <zhichao.gao@intel.com>
> Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> ---
>  .../SmbiosView/EventLogInfo.c                 | 20 +++++++++++++------
>  1 file changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInf
> o.c
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInf
> o.c
> index b8adf438d3..984c178890 100644
> ---
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInf
> o.c
> +++
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInf
> +++ o.c
> @@ -1,9 +1,9 @@
>  /** @file
>    Module for clarifying the content of the smbios structure element info.
> 
> -  Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>
> +  Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.
> + <BR>
>    SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> 
>  #include "UefiShellDebug1CommandsLib.h"
> @@ -345,20 +345,16 @@ DisplaySysEventLogData (
>    // Print Log info
>    //
>    Offset  = 0;
>    Log     = (LOG_RECORD_FORMAT *) LogData;
>    while (Log != NULL && Log->Type != END_OF_LOG && Offset <
> LogAreaLength) {
> -    //
> -    // Get a Event Log Record
> -    //
> -    Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
> 
>      if (Log != NULL) {
>        //
>        // Display Event Log Record Information
>        //
> -      DisplaySELVarDataFormatType (Log->Type, SHOW_DETAIL);
> +      DisplaySELTypes (Log->Type, SHOW_DETAIL);
>        DisplaySELLogHeaderLen (Log->Length, SHOW_DETAIL);
> 
>        Offset += Log->Length;
>        //
>        // Display Log Header Date/Time Fields @@ -371,10 +367,14 @@
> DisplaySysEventLogData (
>          Print (L"19");
>        } else if (Log != NULL && Log->Year <= 79) {
>          Print (L"20");
>        } else {
>          ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN
> (STR_SMBIOSVIEW_EVENTLOGINFO_ERROR), gShellDebug1HiiHandle);
> +        //
> +        // Get a Event Log Record
> +        //
> +        Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
>          continue;
>        }
> 
>        ShellPrintHiiEx(-1,-1,NULL,
>          STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TIME_SIX_VARS),
> @@ -389,13 +389,21 @@ DisplaySysEventLogData (
> 
>        //
>        // Display Variable Data Format
>        //
>        if (Log->Length <= (sizeof (LOG_RECORD_FORMAT) - 1)) {
> +        //
> +        // Get a Event Log Record
> +        //
> +        Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
>          continue;
>        }
> 
>        ElVdfType = Log->LogVariableData[0];
>        DisplayElVdfInfo (ElVdfType, Log->LogVariableData);
> +      //
> +      // Get a Event Log Record
> +      //
> +      Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
>      }
>    }
>  }
> --
> 2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#41549): https://edk2.groups.io/g/devel/message/41549
Mute This Topic: https://groups.io/mt/31816865/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [patch] ShellPkg/Debug1CommandsLib: Fix bugs in func DisplaySysEventLogData
Posted by Dandan Bi 4 years, 11 months ago
Hi Ray and Jaben,

Do you have any comments for this patch?
If no, could you give the R-B and then help push the patch?


Thanks,
Dandan

> -----Original Message-----
> From: Gao, Zhichao
> Sent: Wednesday, May 29, 2019 8:32 AM
> To: Bi, Dandan <dandan.bi@intel.com>; devel@edk2.groups.io;
> oleksiyy@ami.com
> Cc: Carsey, Jaben <jaben.carsey@intel.com>; Ni, Ray <ray.ni@intel.com>
> Subject: RE: [patch] ShellPkg/Debug1CommandsLib: Fix bugs in func
> DisplaySysEventLogData
> 
> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
> 
> > -----Original Message-----
> > From: Bi, Dandan
> > Sent: Tuesday, May 28, 2019 10:25 AM
> > To: devel@edk2.groups.io; oleksiyy@ami.com
> > Cc: Carsey, Jaben <jaben.carsey@intel.com>; Ni, Ray
> > <ray.ni@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
> > Subject: [patch] ShellPkg/Debug1CommandsLib: Fix bugs in func
> > DisplaySysEventLogData
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1498
> >
> > This patch fix following bugs in func DisplaySysEventLogData:
> > 1. Log increment (Log = (LOG_RECORD_FORMAT *) (LogData + Offset);)
> > should happened in the end of while loop, not in the very beginning.
> > 2. DisplaySELTypes function should be used in while loop instead of
> > DisplaySELVarDataFormatType.
> >
> > Cc: Jaben Carsey <jaben.carsey@intel.com>
> > Cc: Ray Ni <ray.ni@intel.com>
> > Cc: Zhichao Gao <zhichao.gao@intel.com>
> > Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> > ---
> >  .../SmbiosView/EventLogInfo.c                 | 20 +++++++++++++------
> >  1 file changed, 14 insertions(+), 6 deletions(-)
> >
> > diff --git
> >
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInf
> > o.c
> >
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInf
> > o.c
> > index b8adf438d3..984c178890 100644
> > ---
> >
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInf
> > o.c
> > +++
> >
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInf
> > +++ o.c
> > @@ -1,9 +1,9 @@
> >  /** @file
> >    Module for clarifying the content of the smbios structure element info.
> >
> > -  Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.
> > <BR>
> > +  Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.
> > + <BR>
> >    SPDX-License-Identifier: BSD-2-Clause-Patent
> >
> >  **/
> >
> >  #include "UefiShellDebug1CommandsLib.h"
> > @@ -345,20 +345,16 @@ DisplaySysEventLogData (
> >    // Print Log info
> >    //
> >    Offset  = 0;
> >    Log     = (LOG_RECORD_FORMAT *) LogData;
> >    while (Log != NULL && Log->Type != END_OF_LOG && Offset <
> > LogAreaLength) {
> > -    //
> > -    // Get a Event Log Record
> > -    //
> > -    Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
> >
> >      if (Log != NULL) {
> >        //
> >        // Display Event Log Record Information
> >        //
> > -      DisplaySELVarDataFormatType (Log->Type, SHOW_DETAIL);
> > +      DisplaySELTypes (Log->Type, SHOW_DETAIL);
> >        DisplaySELLogHeaderLen (Log->Length, SHOW_DETAIL);
> >
> >        Offset += Log->Length;
> >        //
> >        // Display Log Header Date/Time Fields @@ -371,10 +367,14 @@
> > DisplaySysEventLogData (
> >          Print (L"19");
> >        } else if (Log != NULL && Log->Year <= 79) {
> >          Print (L"20");
> >        } else {
> >          ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN
> > (STR_SMBIOSVIEW_EVENTLOGINFO_ERROR), gShellDebug1HiiHandle);
> > +        //
> > +        // Get a Event Log Record
> > +        //
> > +        Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
> >          continue;
> >        }
> >
> >        ShellPrintHiiEx(-1,-1,NULL,
> >          STRING_TOKEN
> (STR_SMBIOSVIEW_EVENTLOGINFO_TIME_SIX_VARS),
> > @@ -389,13 +389,21 @@ DisplaySysEventLogData (
> >
> >        //
> >        // Display Variable Data Format
> >        //
> >        if (Log->Length <= (sizeof (LOG_RECORD_FORMAT) - 1)) {
> > +        //
> > +        // Get a Event Log Record
> > +        //
> > +        Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
> >          continue;
> >        }
> >
> >        ElVdfType = Log->LogVariableData[0];
> >        DisplayElVdfInfo (ElVdfType, Log->LogVariableData);
> > +      //
> > +      // Get a Event Log Record
> > +      //
> > +      Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
> >      }
> >    }
> >  }
> > --
> > 2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#42138): https://edk2.groups.io/g/devel/message/42138
Mute This Topic: https://groups.io/mt/31816865/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [patch] ShellPkg/Debug1CommandsLib: Fix bugs in func DisplaySysEventLogData
Posted by Carsey, Jaben 4 years, 11 months ago
Pushed.

> -----Original Message-----
> From: Bi, Dandan
> Sent: Monday, June 10, 2019 5:52 PM
> To: devel@edk2.groups.io; oleksiyy@ami.com; Ni, Ray <ray.ni@intel.com>;
> Carsey, Jaben <jaben.carsey@intel.com>
> Cc: Gao, Zhichao <zhichao.gao@intel.com>
> Subject: RE: [patch] ShellPkg/Debug1CommandsLib: Fix bugs in func
> DisplaySysEventLogData
> Importance: High
> 
> Hi Ray and Jaben,
> 
> Do you have any comments for this patch?
> If no, could you give the R-B and then help push the patch?
> 
> 
> Thanks,
> Dandan
> 
> > -----Original Message-----
> > From: Gao, Zhichao
> > Sent: Wednesday, May 29, 2019 8:32 AM
> > To: Bi, Dandan <dandan.bi@intel.com>; devel@edk2.groups.io;
> > oleksiyy@ami.com
> > Cc: Carsey, Jaben <jaben.carsey@intel.com>; Ni, Ray <ray.ni@intel.com>
> > Subject: RE: [patch] ShellPkg/Debug1CommandsLib: Fix bugs in func
> > DisplaySysEventLogData
> >
> > Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
> >
> > > -----Original Message-----
> > > From: Bi, Dandan
> > > Sent: Tuesday, May 28, 2019 10:25 AM
> > > To: devel@edk2.groups.io; oleksiyy@ami.com
> > > Cc: Carsey, Jaben <jaben.carsey@intel.com>; Ni, Ray
> > > <ray.ni@intel.com>; Gao, Zhichao <zhichao.gao@intel.com>
> > > Subject: [patch] ShellPkg/Debug1CommandsLib: Fix bugs in func
> > > DisplaySysEventLogData
> > >
> > > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1498
> > >
> > > This patch fix following bugs in func DisplaySysEventLogData:
> > > 1. Log increment (Log = (LOG_RECORD_FORMAT *) (LogData + Offset);)
> > > should happened in the end of while loop, not in the very beginning.
> > > 2. DisplaySELTypes function should be used in while loop instead of
> > > DisplaySELVarDataFormatType.
> > >
> > > Cc: Jaben Carsey <jaben.carsey@intel.com>
> > > Cc: Ray Ni <ray.ni@intel.com>
> > > Cc: Zhichao Gao <zhichao.gao@intel.com>
> > > Signed-off-by: Dandan Bi <dandan.bi@intel.com>
> > > ---
> > >  .../SmbiosView/EventLogInfo.c                 | 20 +++++++++++++------
> > >  1 file changed, 14 insertions(+), 6 deletions(-)
> > >
> > > diff --git
> > >
> >
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInf
> > > o.c
> > >
> >
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInf
> > > o.c
> > > index b8adf438d3..984c178890 100644
> > > ---
> > >
> >
> a/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInf
> > > o.c
> > > +++
> > >
> >
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/EventLogInf
> > > +++ o.c
> > > @@ -1,9 +1,9 @@
> > >  /** @file
> > >    Module for clarifying the content of the smbios structure element info.
> > >
> > > -  Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.
> > > <BR>
> > > +  Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.
> > > + <BR>
> > >    SPDX-License-Identifier: BSD-2-Clause-Patent
> > >
> > >  **/
> > >
> > >  #include "UefiShellDebug1CommandsLib.h"
> > > @@ -345,20 +345,16 @@ DisplaySysEventLogData (
> > >    // Print Log info
> > >    //
> > >    Offset  = 0;
> > >    Log     = (LOG_RECORD_FORMAT *) LogData;
> > >    while (Log != NULL && Log->Type != END_OF_LOG && Offset <
> > > LogAreaLength) {
> > > -    //
> > > -    // Get a Event Log Record
> > > -    //
> > > -    Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
> > >
> > >      if (Log != NULL) {
> > >        //
> > >        // Display Event Log Record Information
> > >        //
> > > -      DisplaySELVarDataFormatType (Log->Type, SHOW_DETAIL);
> > > +      DisplaySELTypes (Log->Type, SHOW_DETAIL);
> > >        DisplaySELLogHeaderLen (Log->Length, SHOW_DETAIL);
> > >
> > >        Offset += Log->Length;
> > >        //
> > >        // Display Log Header Date/Time Fields @@ -371,10 +367,14 @@
> > > DisplaySysEventLogData (
> > >          Print (L"19");
> > >        } else if (Log != NULL && Log->Year <= 79) {
> > >          Print (L"20");
> > >        } else {
> > >          ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN
> > > (STR_SMBIOSVIEW_EVENTLOGINFO_ERROR), gShellDebug1HiiHandle);
> > > +        //
> > > +        // Get a Event Log Record
> > > +        //
> > > +        Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
> > >          continue;
> > >        }
> > >
> > >        ShellPrintHiiEx(-1,-1,NULL,
> > >          STRING_TOKEN
> > (STR_SMBIOSVIEW_EVENTLOGINFO_TIME_SIX_VARS),
> > > @@ -389,13 +389,21 @@ DisplaySysEventLogData (
> > >
> > >        //
> > >        // Display Variable Data Format
> > >        //
> > >        if (Log->Length <= (sizeof (LOG_RECORD_FORMAT) - 1)) {
> > > +        //
> > > +        // Get a Event Log Record
> > > +        //
> > > +        Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
> > >          continue;
> > >        }
> > >
> > >        ElVdfType = Log->LogVariableData[0];
> > >        DisplayElVdfInfo (ElVdfType, Log->LogVariableData);
> > > +      //
> > > +      // Get a Event Log Record
> > > +      //
> > > +      Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
> > >      }
> > >    }
> > >  }
> > > --
> > > 2.18.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#42293): https://edk2.groups.io/g/devel/message/42293
Mute This Topic: https://groups.io/mt/31816865/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-