U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Patrice CHOTARD <patrice.chotard@foss.st.com>
To: "Vincent Stehlé" <vincent.stehle@arm.com>, u-boot@lists.denx.de
Cc: Jassi Brar <jaswinder.singh@linaro.org>,
	Marek Vasut <marex@denx.de>,
	Masahisa Kojima <kojima.masahisa@socionext.com>,
	Michal Simek <michal.simek@amd.com>,
	Patrick Delaunay <patrick.delaunay@foss.st.com>,
	Tom Rini <trini@konsulko.com>,
	<uboot-stm32@st-md-mailman.stormreply.com>
Subject: Re: [PATCH 2/5] board: st: common: fix dfu alt buffer clearing
Date: Tue, 22 Apr 2025 09:32:13 +0200	[thread overview]
Message-ID: <0e7b0b06-d100-4db5-aa84-9eb9767f4e0d@foss.st.com> (raw)
In-Reply-To: <20250407170529.893307-3-vincent.stehle@arm.com>



On 4/7/25 19:05, Vincent Stehlé wrote:
> The set_dfu_alt_info() function calls the ALLOC_CACHE_ALIGN_BUFFER()
> macro to declare a `buf' variable pointer into an array allocated on the
> stack. It then calls the memset() function to clear the useable portion
> of the array using the idiomatic expression `sizeof(buf)'.
> 
> While this would indeed work fine for an array, in the present case we
> end up clearing only the size of a pointer.
> Fix this by specifying the explicit size `DFU_ALT_BUF_LEN' instead.
> 
> Fixes: ec2933e543df ("board: stm32mp1: move set_dfu_alt_info in st common directory")
> Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
> Cc: Patrice Chotard <patrice.chotard@foss.st.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Marek Vasut <marex@denx.de>
> ---
>  board/st/common/stm32mp_dfu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/board/st/common/stm32mp_dfu.c b/board/st/common/stm32mp_dfu.c
> index 1db8e45480e..8c1f80b678a 100644
> --- a/board/st/common/stm32mp_dfu.c
> +++ b/board/st/common/stm32mp_dfu.c
> @@ -105,7 +105,7 @@ void set_dfu_alt_info(char *interface, char *devstr)
>  	if (env_get("dfu_alt_info"))
>  		return;
>  
> -	memset(buf, 0, sizeof(buf));
> +	memset(buf, 0, DFU_ALT_BUF_LEN);
>  
>  	snprintf(buf, DFU_ALT_BUF_LEN,
>  		 "ram 0=%s", CONFIG_DFU_ALT_RAM0);

Hi Vincent,

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks

  parent reply	other threads:[~2025-04-22  7:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07 17:05 [PATCH 0/5] fix dfu alt buffer clearing Vincent Stehlé
2025-04-07 17:05 ` [PATCH 1/5] fwu: developerbox: " Vincent Stehlé
2025-04-14 12:22   ` Mattijs Korpershoek
2025-04-07 17:05 ` [PATCH 2/5] board: st: common: " Vincent Stehlé
2025-04-14 12:24   ` Mattijs Korpershoek
2025-04-14 12:35     ` Mattijs Korpershoek
2025-04-22  7:32   ` Patrice CHOTARD [this message]
2025-05-05 13:28     ` Patrice CHOTARD
2025-04-07 17:05 ` [PATCH 3/5] arm64: versal: " Vincent Stehlé
2025-04-11  3:56   ` Begari, Padmarao
2025-04-14  6:28   ` Michal Simek
2025-04-07 17:05 ` [PATCH 4/5] xilinx: zynq: " Vincent Stehlé
2025-04-11  3:57   ` Begari, Padmarao
2025-04-14  6:28   ` Michal Simek
2025-04-07 17:05 ` [PATCH 5/5] arm64: zynqmp: " Vincent Stehlé
2025-04-11  3:57   ` Begari, Padmarao
2025-04-14  6:29   ` Michal Simek
2025-04-23  7:53 ` (subset) [PATCH 0/5] " Mattijs Korpershoek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0e7b0b06-d100-4db5-aa84-9eb9767f4e0d@foss.st.com \
    --to=patrice.chotard@foss.st.com \
    --cc=jaswinder.singh@linaro.org \
    --cc=kojima.masahisa@socionext.com \
    --cc=marex@denx.de \
    --cc=michal.simek@amd.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-stm32@st-md-mailman.stormreply.com \
    --cc=vincent.stehle@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox