diff mbox series

[3/3] bootstd: Fix incorrect struct name in bootmeth_setup_iter_order()

Message ID 20250112034213.13153-4-semen.protsenko@linaro.org
State New
Headers show
Series bootstd: Fix efi_mgr usage in bootmeths env var | expand

Commit Message

Sam Protsenko Jan. 12, 2025, 3:42 a.m. UTC
There is no such thing as struct bootmeth, it's probably a typo. This
issue doesn't affect the execution as it's a pointer, and pointer sizes
are the same for all data types. But it can be confusing, so make it
struct udevice, as it should be.

Fixes: a950d31abe98 ("bootstd: Add the bootmeth uclass and helpers")
Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
---
 boot/bootmeth-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Heinrich Schuchardt Jan. 13, 2025, 7:49 a.m. UTC | #1
On 1/12/25 04:42, Sam Protsenko wrote:
> There is no such thing as struct bootmeth, it's probably a typo. This
> issue doesn't affect the execution as it's a pointer, and pointer sizes
> are the same for all data types. But it can be confusing, so make it
> struct udevice, as it should be.
>
> Fixes: a950d31abe98 ("bootstd: Add the bootmeth uclass and helpers")
> Signed-off-by: Sam Protsenko <semen.protsenko@linaro.org>
> ---
>   boot/bootmeth-uclass.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/boot/bootmeth-uclass.c b/boot/bootmeth-uclass.c
> index 049389403191..2496e8c1d8a8 100644
> --- a/boot/bootmeth-uclass.c
> +++ b/boot/bootmeth-uclass.c
> @@ -139,7 +139,7 @@ int bootmeth_setup_iter_order(struct bootflow_iter *iter, bool include_global)
>   			goto err_order;
>   		}
>   		memcpy(order, std->bootmeth_order,
> -		       count * sizeof(struct bootmeth *));
> +		       count * sizeof(struct udevice *));

I found this description of the field:
@bootmeth_order: List of bootmeth devices to use, in order, NULL-terminated

As the list is NULL terminated, shouldn't we copy the NULL value, i.e.

     (count + 1) * sizeof(struct udevice *)

so that we can still identify the end of the list?

Best regards

Heinrich

>
>   		if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL)) {
>   			for (i = 0; i < count; i++) {
diff mbox series

Patch

diff --git a/boot/bootmeth-uclass.c b/boot/bootmeth-uclass.c
index 049389403191..2496e8c1d8a8 100644
--- a/boot/bootmeth-uclass.c
+++ b/boot/bootmeth-uclass.c
@@ -139,7 +139,7 @@  int bootmeth_setup_iter_order(struct bootflow_iter *iter, bool include_global)
 			goto err_order;
 		}
 		memcpy(order, std->bootmeth_order,
-		       count * sizeof(struct bootmeth *));
+		       count * sizeof(struct udevice *));
 
 		if (IS_ENABLED(CONFIG_BOOTMETH_GLOBAL)) {
 			for (i = 0; i < count; i++) {