diff mbox series

efi_loader: Fix to set bootdev_root correctly if bootdev found

Message ID 162608071685.188144.16073566533117803794.stgit@localhost
State Accepted
Commit b0b1449b3be9b93ecc57d91b0cb18ed81fc8a1ee
Headers show
Series efi_loader: Fix to set bootdev_root correctly if bootdev found | expand

Commit Message

Masami Hiramatsu July 12, 2021, 9:05 a.m. UTC
Fix find_boot_device() to set bootdev_root if it finds the
bootdev from BootNext. Currently it sets the bootdev_root only
when it finds bootdev from BootOrder.

Fixes: c74cd8bd08d1 ("efi_loader: capsule: add capsule_on_disk support")
Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>

---
 lib/efi_loader/efi_capsule.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Heinrich Schuchardt July 12, 2021, 5:40 p.m. UTC | #1
On 7/12/21 11:05 AM, Masami Hiramatsu wrote:
> Fix find_boot_device() to set bootdev_root if it finds the

> bootdev from BootNext. Currently it sets the bootdev_root only

> when it finds bootdev from BootOrder.

>

> Fixes: c74cd8bd08d1 ("efi_loader: capsule: add capsule_on_disk support")

> Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>

> ---

>   lib/efi_loader/efi_capsule.c |    3 ++-

>   1 file changed, 2 insertions(+), 1 deletion(-)

>

> diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c

> index 50bed32bfb..b736f4ef9e 100644

> --- a/lib/efi_loader/efi_capsule.c

> +++ b/lib/efi_loader/efi_capsule.c

> @@ -632,7 +632,7 @@ static efi_status_t find_boot_device(void)

>   		ret = get_dp_device(boot_var16, &boot_dev);

>   		if (ret == EFI_SUCCESS) {

>   			if (device_is_present_and_system_part(boot_dev)) {

> -				goto out;

> +				goto found;

>   			} else {

>   				efi_free_pool(boot_dev);

>   				boot_dev = NULL;

> @@ -675,6 +675,7 @@ skip:

>   		efi_free_pool(boot_dev);

>   		boot_dev = NULL;

>   	}

> +found:

>   	if (boot_dev) {

>   		u16 *path_str;


The code that follows should be reworked too:

<cite>
u16 *path_str;

path_str = efi_dp_str(boot_dev);
log_debug("Boot device %ls\n", path_str);
efi_free_pool(path_str);
</cite>

Use log-debug("Boot device %pD\n", boot_dev); instead.

But that is work for a separate patch.

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>


>

>
Ilias Apalodimas July 12, 2021, 5:59 p.m. UTC | #2
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>


On Mon, 12 Jul 2021 at 20:40, Heinrich Schuchardt <xypron.glpk@gmx.de> wrote:
>

> On 7/12/21 11:05 AM, Masami Hiramatsu wrote:

> > Fix find_boot_device() to set bootdev_root if it finds the

> > bootdev from BootNext. Currently it sets the bootdev_root only

> > when it finds bootdev from BootOrder.

> >

> > Fixes: c74cd8bd08d1 ("efi_loader: capsule: add capsule_on_disk support")

> > Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>

> > ---

> >   lib/efi_loader/efi_capsule.c |    3 ++-

> >   1 file changed, 2 insertions(+), 1 deletion(-)

> >

> > diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c

> > index 50bed32bfb..b736f4ef9e 100644

> > --- a/lib/efi_loader/efi_capsule.c

> > +++ b/lib/efi_loader/efi_capsule.c

> > @@ -632,7 +632,7 @@ static efi_status_t find_boot_device(void)

> >               ret = get_dp_device(boot_var16, &boot_dev);

> >               if (ret == EFI_SUCCESS) {

> >                       if (device_is_present_and_system_part(boot_dev)) {

> > -                             goto out;

> > +                             goto found;

> >                       } else {

> >                               efi_free_pool(boot_dev);

> >                               boot_dev = NULL;

> > @@ -675,6 +675,7 @@ skip:

> >               efi_free_pool(boot_dev);

> >               boot_dev = NULL;

> >       }

> > +found:

> >       if (boot_dev) {

> >               u16 *path_str;

>

> The code that follows should be reworked too:

>

> <cite>

> u16 *path_str;

>

> path_str = efi_dp_str(boot_dev);

> log_debug("Boot device %ls\n", path_str);

> efi_free_pool(path_str);

> </cite>

>

> Use log-debug("Boot device %pD\n", boot_dev); instead.

>

> But that is work for a separate patch.

>

> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

>

> >

> >

>
Masami Hiramatsu July 13, 2021, 11:40 p.m. UTC | #3
Hi Heinrich,

2021年7月13日(火) 2:40 Heinrich Schuchardt <xypron.glpk@gmx.de>:
>

> On 7/12/21 11:05 AM, Masami Hiramatsu wrote:

> > Fix find_boot_device() to set bootdev_root if it finds the

> > bootdev from BootNext. Currently it sets the bootdev_root only

> > when it finds bootdev from BootOrder.

> >

> > Fixes: c74cd8bd08d1 ("efi_loader: capsule: add capsule_on_disk support")

> > Signed-off-by: Masami Hiramatsu <masami.hiramatsu@linaro.org>

> > ---

> >   lib/efi_loader/efi_capsule.c |    3 ++-

> >   1 file changed, 2 insertions(+), 1 deletion(-)

> >

> > diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c

> > index 50bed32bfb..b736f4ef9e 100644

> > --- a/lib/efi_loader/efi_capsule.c

> > +++ b/lib/efi_loader/efi_capsule.c

> > @@ -632,7 +632,7 @@ static efi_status_t find_boot_device(void)

> >               ret = get_dp_device(boot_var16, &boot_dev);

> >               if (ret == EFI_SUCCESS) {

> >                       if (device_is_present_and_system_part(boot_dev)) {

> > -                             goto out;

> > +                             goto found;

> >                       } else {

> >                               efi_free_pool(boot_dev);

> >                               boot_dev = NULL;

> > @@ -675,6 +675,7 @@ skip:

> >               efi_free_pool(boot_dev);

> >               boot_dev = NULL;

> >       }

> > +found:

> >       if (boot_dev) {

> >               u16 *path_str;

>

> The code that follows should be reworked too:

>

> <cite>

> u16 *path_str;

>

> path_str = efi_dp_str(boot_dev);

> log_debug("Boot device %ls\n", path_str);

> efi_free_pool(path_str);

> </cite>

>

> Use log-debug("Boot device %pD\n", boot_dev); instead.

>

> But that is work for a separate patch.


OK, let me fix that.

>

> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>


Thank you!

>

> >

> >

>



-- 
Masami Hiramatsu
diff mbox series

Patch

diff --git a/lib/efi_loader/efi_capsule.c b/lib/efi_loader/efi_capsule.c
index 50bed32bfb..b736f4ef9e 100644
--- a/lib/efi_loader/efi_capsule.c
+++ b/lib/efi_loader/efi_capsule.c
@@ -632,7 +632,7 @@  static efi_status_t find_boot_device(void)
 		ret = get_dp_device(boot_var16, &boot_dev);
 		if (ret == EFI_SUCCESS) {
 			if (device_is_present_and_system_part(boot_dev)) {
-				goto out;
+				goto found;
 			} else {
 				efi_free_pool(boot_dev);
 				boot_dev = NULL;
@@ -675,6 +675,7 @@  skip:
 		efi_free_pool(boot_dev);
 		boot_dev = NULL;
 	}
+found:
 	if (boot_dev) {
 		u16 *path_str;