On 05/26/16 12:24, Gary Lin wrote:
> When OVMF tried to restore the variables from the file-based NvVars, it
> failed to set the read-only variable and aborted the restoration with
> this message:
> 
> Variable Check ReadOnly variable fail Write Protected - 
> 04B37FE8-F6AE-480B-BDD5-37D98C5E89AA:VarErrorFlag
> 
> Since it's a read-only variable maintained by the firmware, it's
> pointless to restore the previous value, so the check can be
> relaxed to allow EFI_WRITE_PROTECTED returned from SetVariable.
> 
> Cc: Laszlo Ersek <[email protected]>
> Cc: Jordan Justen <[email protected]>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Gary Lin <[email protected]>
> ---
>  OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c 
> b/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c
> index 6822c5c..bf8ad31 100644
> --- a/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c
> +++ b/OvmfPkg/Library/SerializeVariablesLib/SerializeVariablesLib.c
> @@ -302,6 +302,11 @@ IterateVariablesCallbackSetSystemVariable (
>              "failed with EFI_SECURITY_VIOLATION, ignoring\n", __FUNCTION__,
>              VariableName));
>      Status = EFI_SUCCESS;
> +  } else if (Status == EFI_WRITE_PROTECTED) {
> +    DEBUG ((DEBUG_WARN, "%a: setting ReadOnly variable \"%s\" "
> +            "failed with EFI_WRITE_PROTECTED, ignoring\n", __FUNCTION__,
> +            VariableName));
> +    Status = EFI_SUCCESS;
>    }
>    return Status;
>  }
> 

This is a logical continuation of commit e678f9db899ad by yours truly.

Reviewed-by: Laszlo Ersek <[email protected]>

While applying this patch, git-am reported a conflict. Of course, it was
due to line endings. I was surprised because my git-am setup handles
CRLF just fine.

And that's when I noticed, in OvmfPkg/Library/SerializeVariablesLib/:

  SerializeVariablesLib.c:   C source, ASCII text, with CRLF, LF line
                             terminators
  SerializeVariablesLib.h:   C source, ASCII text
  SerializeVariablesLib.inf: ASCII text, with CRLF line terminators

So, the INF file is fine, the header file is completely wrong wrt. line
endings, and the C file has mixed endings. Apparently, the only CRLF
terminators in the C file come from the above-referenced commit
e678f9db899ad.

So, what I'm doing now is this: I will convert all files in this
directory to uniform CRLF, and commit that patch without posting it for
review.

On top, your patch will be applied.

... Commit db827286e283.

Thanks
Laszlo
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to