public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
To: Eric Jin <eric.jin@intel.com>, edk2-devel@lists.01.org
Cc: Jiaxin Wu <jiaxin.wu@intel.com>, supreeth.venkatesh@arm.com
Subject: Re: [edk2-test][Patch] uefi-sct/SctPkg:Assign 0 to the tail of the HwErrRecVariableName
Date: Tue, 30 Oct 2018 11:59:46 -0500	[thread overview]
Message-ID: <7350d7ed7b696e08585dceeb88d5f379620184ee.camel@arm.com> (raw)
In-Reply-To: <20181030083836.7184-1-eric.jin@intel.com>

Reviewed-by: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
If the below magic number comments(inline) are fixed before commit.

On Tue, 2018-10-30 at 16:38 +0800, Eric Jin wrote:
> Make the HwErrRecVariableName as valid the string.
> Ensure the HwErrRecVariable could be deleted before the test exit.
> 
> Cc: Supreeth Venkatesh <supreeth.venkatesh@arm.com>
> Cc: Jiaxin Wu <jiaxin.wu@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Jin <eric.jin@intel.com>
> ---
>  .../BlackBoxTest/VariableServicesBBTestFunction.c            | 12
> +++++++-----
>  .../BlackBoxTest/VariableServicesBBTestMain.h                | 10
> +++++++++-
>  2 files changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> xTest/VariableServicesBBTestFunction.c b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> xTest/VariableServicesBBTestFunction.c
> index d1064ce..df1bbe7 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> xTest/VariableServicesBBTestFunction.c
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> xTest/VariableServicesBBTestFunction.c
> @@ -1,7 +1,7 @@
>  /** @file
>  
>    Copyright 2006 - 2012 Unified EFI, Inc.<BR>
> -  Copyright (c) 2010 - 2012, Intel Corporation. All rights
> reserved.<BR>
> +  Copyright (c) 2010 - 2018, 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
> @@ -2855,7 +2855,7 @@ HardwareErrorRecordFuncTest (
>    UINT64                RemainingVariableStorageSize;
>    UINT64                MaximumVariableSize;
>    
> -  CHAR16                HwErrRecVariableName[13];
> +  CHAR16                HwErrRecVariableName[HwErrRecVariableNameLen
> gth];
>    CHAR16                HwErrRecVariable[] = L"This is a HwErrRec
> variable!";
>    
>    CHAR16                GetVariableName[MAX_BUFFER_SIZE];
> @@ -3015,6 +3015,7 @@ HardwareErrorRecordFuncTest (
>    HwErrRecVariableName[0] = L'\0';
>    SctStrCat ( HwErrRecVariableName, L"HwErrRec" );
>    Myitox( MaxNum, HwErrRecVariableName+8 );
I understand this line is not part of this patch, but however can we
define "#define" for magic number 8, while we are touching this file.

> +  HwErrRecVariableName[HwErrRecVariableNameLength-1] = L'\0';
>    
>    //
>    // Set the new HwErrRec variable to the global variable
> @@ -3036,8 +3037,8 @@ HardwareErrorRecordFuncTest (
>    // Write reset record
>    //
>    RecoveryData[0] = 2;
I understand this line is not part of this patch, but however can we
define "#define" for magic number 2, while we are touching this file.

> -  SctStrnCpy ( (CHAR16*)(&RecoveryData[2]), HwErrRecVariableName, 12
> );
> -  RecoveryLib->WriteResetRecord( RecoveryLib, 13*sizeof(CHAR16)+2,
> RecoveryData );
> +  SctStrnCpy ( (CHAR16*)(&RecoveryData[2]), HwErrRecVariableName,
> HwErrRecVariableNameLength-1 );
"#define" for magic number 2

> +  RecoveryLib->WriteResetRecord( RecoveryLib,
> HwErrRecVariableNameLength*sizeof(CHAR16)+2, RecoveryData );
"#define" for magic number 2

>    
>    //
>    // Prompt the user about the cold reset and reset the system
> @@ -3052,7 +3053,8 @@ HardwareErrorRecordFuncTest (
>    //
>  step2:
>    DataSize = 255;
> -  SctStrnCpy ( HwErrRecVariableName, (CHAR16*)(RecoveryData+2), 12
> );
> +  HwErrRecVariableName[HwErrRecVariableNameLength-1] = L'\0';
> +  SctStrnCpy ( HwErrRecVariableName, (CHAR16*)(RecoveryData+2), 
"#define" for magic number 2

> HwErrRecVariableNameLength-1 );
>    Status = RT->GetVariable (
>                          HwErrRecVariableName,
>                          &gHwErrRecGuid,
> diff --git a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> xTest/VariableServicesBBTestMain.h b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> xTest/VariableServicesBBTestMain.h
> index 051ae6f..b645b55 100644
> --- a/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> xTest/VariableServicesBBTestMain.h
> +++ b/uefi-
> sct/SctPkg/TestCase/UEFI/EFI/RuntimeServices/VariableServices/BlackBo
> xTest/VariableServicesBBTestMain.h
> @@ -1,7 +1,7 @@
>  /** @file
>  
>    Copyright 2006 - 2016 Unified EFI, Inc.<BR>
> -  Copyright (c) 2010 - 2016, Intel Corporation. All rights
> reserved.<BR>
> +  Copyright (c) 2010 - 2018, 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
> @@ -125,6 +125,14 @@ Abstract:
>  #endif
>  
>  //
> +// The Variable Name of Hardware Error Record Variables 
> +// defined in the UEFI Spec is HwErrRec####. For example,
> +// HwErrRec0001, HwErrRec0002, HwErrRecF31A, etc. 
> +// Consider the tail of string, the length is 13.
> +//
Good documentation.

> +#define HwErrRecVariableNameLength 13
> +
> +//
>  // Global Variables
>  //
>  



  parent reply	other threads:[~2018-10-30 16:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-30  8:38 [edk2-test][Patch] uefi-sct/SctPkg:Assign 0 to the tail of the HwErrRecVariableName Eric Jin
2018-10-30 10:43 ` Leif Lindholm
2018-10-30 16:59 ` Supreeth Venkatesh [this message]
2018-10-31  2:29   ` Jin, Eric
2018-10-31 16:24     ` Supreeth Venkatesh
2018-11-01  2:08       ` Jin, Eric
2018-11-01 20:06         ` Supreeth Venkatesh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7350d7ed7b696e08585dceeb88d5f379620184ee.camel@arm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox