Re: [PATCH 1/1] efi_loader: improve efi_var_from_file() description
On Mon, 13 Nov 2023 at 07:50, Heinrich Schuchardt wrote: > > It is unclear to developers why efi_var_from_file() returns EFI_SUCCESS if > file ubootefi.var is missing or corrupted. Improve the description. > > Reported-by: Weizhao Ouyang > Signed-off-by: Heinrich Schuchardt > --- > lib/efi_loader/efi_var_file.c | 7 +-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c > index 62e071bd83..dbf76f93de 100644 > --- a/lib/efi_loader/efi_var_file.c > +++ b/lib/efi_loader/efi_var_file.c > @@ -204,8 +204,11 @@ efi_status_t efi_var_restore(struct efi_var_file *buf, > bool safe) > * File ubootefi.var is read from the EFI system partitions and the variables > * stored in the file are created. > * > - * In case the file does not exist yet or a variable cannot be set > EFI_SUCCESS > - * is returned. > + * On first boot the file ubootefi.var does not exist yet. This is if why we s/if// Reviewed-by: Simon Glass > + * must return EFI_SUCCESS in this case. > + * > + * If the variable file is corrupted, e.g. incorrect CRC32, we do not want to > + * stop the boot process. We deliberately return EFI_SUCCESS in this case, > too. Does this mean that the file will be erased? Doesn't that mean that all the settings are lost? > * > * Return: status code > */ > -- > 2.40.1 > Regards, Simon
Re: [PATCH 1/1] efi_loader: improve efi_var_from_file() description
On Mon, Nov 13, 2023 at 10:50 PM Heinrich Schuchardt wrote: > > It is unclear to developers why efi_var_from_file() returns EFI_SUCCESS if > file ubootefi.var is missing or corrupted. Improve the description. > > Reported-by: Weizhao Ouyang > Signed-off-by: Heinrich Schuchardt > --- > lib/efi_loader/efi_var_file.c | 7 +-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c > index 62e071bd83..dbf76f93de 100644 > --- a/lib/efi_loader/efi_var_file.c > +++ b/lib/efi_loader/efi_var_file.c > @@ -204,8 +204,11 @@ efi_status_t efi_var_restore(struct efi_var_file *buf, > bool safe) > * File ubootefi.var is read from the EFI system partitions and the variables > * stored in the file are created. > * > - * In case the file does not exist yet or a variable cannot be set > EFI_SUCCESS > - * is returned. > + * On first boot the file ubootefi.var does not exist yet. This is if why we > + * must return EFI_SUCCESS in this case. > + * > + * If the variable file is corrupted, e.g. incorrect CRC32, we do not want to > + * stop the boot process. We deliberately return EFI_SUCCESS in this case, > too. Reviewed-by: Weizhao Ouyang > * > * Return: status code > */ > -- > 2.40.1 >
[PATCH 1/1] efi_loader: improve efi_var_from_file() description
It is unclear to developers why efi_var_from_file() returns EFI_SUCCESS if file ubootefi.var is missing or corrupted. Improve the description. Reported-by: Weizhao Ouyang Signed-off-by: Heinrich Schuchardt --- lib/efi_loader/efi_var_file.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c index 62e071bd83..dbf76f93de 100644 --- a/lib/efi_loader/efi_var_file.c +++ b/lib/efi_loader/efi_var_file.c @@ -204,8 +204,11 @@ efi_status_t efi_var_restore(struct efi_var_file *buf, bool safe) * File ubootefi.var is read from the EFI system partitions and the variables * stored in the file are created. * - * In case the file does not exist yet or a variable cannot be set EFI_SUCCESS - * is returned. + * On first boot the file ubootefi.var does not exist yet. This is if why we + * must return EFI_SUCCESS in this case. + * + * If the variable file is corrupted, e.g. incorrect CRC32, we do not want to + * stop the boot process. We deliberately return EFI_SUCCESS in this case, too. * * Return: status code */ -- 2.40.1