Hi Nicolas,

Thank you for the patch.

On mer., déc. 11, 2024 at 14:53, Nicolas Belin <[email protected]> wrote:

> Keep the same order (bootargs then kcmdline then kcmdline_extra)
> for both the length calculation and the string concatenation steps.
>
> Signed-off-by: Nicolas Belin <[email protected]>

Reviewed-by: Mattijs Korpershoek <[email protected]>

> ---
>  boot/image-android.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/boot/image-android.c b/boot/image-android.c
> index 
> ed72a5c30424a453c1800bc61edbe8f33b31b341..a76f028090d0470842bbf559b638175949c527f0
>  100644
> --- a/boot/image-android.c
> +++ b/boot/image-android.c
> @@ -287,6 +287,11 @@ int android_image_get_kernel(const void *hdr,
>              kernel_addr, DIV_ROUND_UP(img_data.kernel_size, 1024));
>  
>       int len = 0;
> +     char *bootargs = env_get("bootargs");
> +
> +     if (bootargs)
> +             len += strlen(bootargs) + 1; /* Extra space character needed */
> +
>       if (*img_data.kcmdline) {
>               printf("Kernel command line: %s\n", img_data.kcmdline);
>               len += strlen(img_data.kcmdline) + 1; /* Extra space character 
> needed */
> @@ -297,10 +302,6 @@ int android_image_get_kernel(const void *hdr,
>               len += strlen(img_data.kcmdline_extra);
>       }
>  
> -     char *bootargs = env_get("bootargs");
> -     if (bootargs)
> -             len += strlen(bootargs) + 1; /* Extra space character needed */
> -
>       char *newbootargs = malloc(len + 1); /* +1 for the '\0' */
>       if (!newbootargs) {
>               puts("Error: malloc in android_image_get_kernel failed!\n");
>
> -- 
> 2.34.1

Reply via email to