All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] bootstd: android: Add missing free in android_read_bootflow
@ 2026-01-14  9:14 Francois Berder
  2026-01-14 14:47 ` Tom Rini
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Francois Berder @ 2026-01-14  9:14 UTC (permalink / raw)
  To: u-boot; +Cc: Simon Glass, Mattijs Korpershoek, Tom Rini

If strdup call fails, one needs to free priv variable.

Signed-off-by: Francois Berder <fberder@outlook.fr>
---
 boot/bootmeth_android.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/boot/bootmeth_android.c b/boot/bootmeth_android.c
index 1374551dbeb..1d70e8d5c05 100644
--- a/boot/bootmeth_android.c
+++ b/boot/bootmeth_android.c
@@ -252,8 +252,10 @@ static int android_read_bootflow(struct udevice *dev, struct bootflow *bflow)
 		priv->boot_mode = ANDROID_BOOT_MODE_NORMAL;
 		bflow->os_name = strdup("Android");
 	}
-	if (!bflow->os_name)
+	if (!bflow->os_name) {
+		free(priv);
 		return log_msg_ret("os", -ENOMEM);
+	}
 
 	if (priv->boot_mode == ANDROID_BOOT_MODE_BOOTLOADER) {
 		/* Clear BCB */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] bootstd: android: Add missing free in android_read_bootflow
  2026-01-14  9:14 [PATCH] bootstd: android: Add missing free in android_read_bootflow Francois Berder
@ 2026-01-14 14:47 ` Tom Rini
  2026-01-15  8:23 ` Mattijs Korpershoek
  2026-01-15  8:26 ` Mattijs Korpershoek
  2 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2026-01-14 14:47 UTC (permalink / raw)
  To: Francois Berder; +Cc: u-boot, Simon Glass, Mattijs Korpershoek

[-- Attachment #1: Type: text/plain, Size: 243 bytes --]

On Wed, Jan 14, 2026 at 10:14:55AM +0100, Francois Berder wrote:

> If strdup call fails, one needs to free priv variable.
> 
> Signed-off-by: Francois Berder <fberder@outlook.fr>

Reviewed-by: Tom Rini <trini@konsulko.com>

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] bootstd: android: Add missing free in android_read_bootflow
  2026-01-14  9:14 [PATCH] bootstd: android: Add missing free in android_read_bootflow Francois Berder
  2026-01-14 14:47 ` Tom Rini
@ 2026-01-15  8:23 ` Mattijs Korpershoek
  2026-01-15  8:26 ` Mattijs Korpershoek
  2 siblings, 0 replies; 4+ messages in thread
From: Mattijs Korpershoek @ 2026-01-15  8:23 UTC (permalink / raw)
  To: Francois Berder, u-boot; +Cc: Simon Glass, Mattijs Korpershoek, Tom Rini

Hi Francois,

Thank you for the patch.

On Wed, Jan 14, 2026 at 10:14, Francois Berder <fberder@outlook.fr> wrote:

> If strdup call fails, one needs to free priv variable.
>
> Signed-off-by: Francois Berder <fberder@outlook.fr>

Good catch! Thanks for the fix.

Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>

> ---
>  boot/bootmeth_android.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/boot/bootmeth_android.c b/boot/bootmeth_android.c
> index 1374551dbeb..1d70e8d5c05 100644
> --- a/boot/bootmeth_android.c
> +++ b/boot/bootmeth_android.c
> @@ -252,8 +252,10 @@ static int android_read_bootflow(struct udevice *dev, struct bootflow *bflow)
>  		priv->boot_mode = ANDROID_BOOT_MODE_NORMAL;
>  		bflow->os_name = strdup("Android");
>  	}
> -	if (!bflow->os_name)
> +	if (!bflow->os_name) {
> +		free(priv);
>  		return log_msg_ret("os", -ENOMEM);
> +	}
>  
>  	if (priv->boot_mode == ANDROID_BOOT_MODE_BOOTLOADER) {
>  		/* Clear BCB */
> -- 
> 2.43.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] bootstd: android: Add missing free in android_read_bootflow
  2026-01-14  9:14 [PATCH] bootstd: android: Add missing free in android_read_bootflow Francois Berder
  2026-01-14 14:47 ` Tom Rini
  2026-01-15  8:23 ` Mattijs Korpershoek
@ 2026-01-15  8:26 ` Mattijs Korpershoek
  2 siblings, 0 replies; 4+ messages in thread
From: Mattijs Korpershoek @ 2026-01-15  8:26 UTC (permalink / raw)
  To: u-boot, Francois Berder; +Cc: Simon Glass, Tom Rini

Hi,

On Wed, 14 Jan 2026 10:14:55 +0100, Francois Berder wrote:
> If strdup call fails, one needs to free priv variable.
> 
> 

Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-dfu (u-boot-dfu)

[1/1] bootstd: android: Add missing free in android_read_bootflow
      https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/8fa0cf5f3d7ca15e2d102d0d46a132d246793486

--
Mattijs

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-01-15  8:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-14  9:14 [PATCH] bootstd: android: Add missing free in android_read_bootflow Francois Berder
2026-01-14 14:47 ` Tom Rini
2026-01-15  8:23 ` Mattijs Korpershoek
2026-01-15  8:26 ` Mattijs Korpershoek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.