* [PATCH 1/5] fwu: developerbox: fix dfu alt buffer clearing
2025-04-07 17:05 [PATCH 0/5] fix dfu alt buffer clearing Vincent Stehlé
@ 2025-04-07 17:05 ` Vincent Stehlé
2025-04-14 12:22 ` Mattijs Korpershoek
2025-04-07 17:05 ` [PATCH 2/5] board: st: common: " Vincent Stehlé
` (4 subsequent siblings)
5 siblings, 1 reply; 18+ messages in thread
From: Vincent Stehlé @ 2025-04-07 17:05 UTC (permalink / raw)
To: u-boot
Cc: Vincent Stehlé, Jassi Brar, Marek Vasut, Masahisa Kojima,
Michal Simek, Patrice Chotard, Patrick Delaunay, Tom Rini
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: 6b403ca4dcf4 ("fwu: DeveloperBox: add support for FWU")
Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Masahisa Kojima <kojima.masahisa@socionext.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Jassi Brar <jaswinder.singh@linaro.org>
---
board/socionext/developerbox/fwu_plat.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/socionext/developerbox/fwu_plat.c b/board/socionext/developerbox/fwu_plat.c
index 26031795b09..a8b111477ef 100644
--- a/board/socionext/developerbox/fwu_plat.c
+++ b/board/socionext/developerbox/fwu_plat.c
@@ -18,7 +18,7 @@ void set_dfu_alt_info(char *interface, char *devstr)
struct mtd_info *mtd;
int ret;
- memset(buf, 0, sizeof(buf));
+ memset(buf, 0, DFU_ALT_BUF_LEN);
mtd_probe_devices();
--
2.47.2
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH 1/5] fwu: developerbox: fix dfu alt buffer clearing
2025-04-07 17:05 ` [PATCH 1/5] fwu: developerbox: " Vincent Stehlé
@ 2025-04-14 12:22 ` Mattijs Korpershoek
0 siblings, 0 replies; 18+ messages in thread
From: Mattijs Korpershoek @ 2025-04-14 12:22 UTC (permalink / raw)
To: Vincent Stehlé, u-boot
Cc: Vincent Stehlé, Jassi Brar, Marek Vasut, Masahisa Kojima,
Michal Simek, Patrice Chotard, Patrick Delaunay, Tom Rini
Hi Vincent,
Thank you for the patch.
On lun., avril 07, 2025 at 19:05, Vincent Stehlé <vincent.stehle@arm.com> 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: 6b403ca4dcf4 ("fwu: DeveloperBox: add support for FWU")
> Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
> Cc: Masahisa Kojima <kojima.masahisa@socionext.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: Jassi Brar <jaswinder.singh@linaro.org>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
> ---
> board/socionext/developerbox/fwu_plat.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/board/socionext/developerbox/fwu_plat.c b/board/socionext/developerbox/fwu_plat.c
> index 26031795b09..a8b111477ef 100644
> --- a/board/socionext/developerbox/fwu_plat.c
> +++ b/board/socionext/developerbox/fwu_plat.c
> @@ -18,7 +18,7 @@ void set_dfu_alt_info(char *interface, char *devstr)
> struct mtd_info *mtd;
> int ret;
>
> - memset(buf, 0, sizeof(buf));
> + memset(buf, 0, DFU_ALT_BUF_LEN);
>
> mtd_probe_devices();
>
> --
> 2.47.2
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 2/5] board: st: common: fix dfu alt buffer clearing
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-07 17:05 ` Vincent Stehlé
2025-04-14 12:24 ` Mattijs Korpershoek
2025-04-22 7:32 ` Patrice CHOTARD
2025-04-07 17:05 ` [PATCH 3/5] arm64: versal: " Vincent Stehlé
` (3 subsequent siblings)
5 siblings, 2 replies; 18+ messages in thread
From: Vincent Stehlé @ 2025-04-07 17:05 UTC (permalink / raw)
To: u-boot
Cc: Vincent Stehlé, Jassi Brar, Marek Vasut, Masahisa Kojima,
Michal Simek, Patrice Chotard, Patrick Delaunay, Tom Rini,
uboot-stm32
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);
--
2.47.2
^ permalink raw reply related [flat|nested] 18+ messages in thread* Re: [PATCH 2/5] board: st: common: fix dfu alt buffer clearing
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
1 sibling, 1 reply; 18+ messages in thread
From: Mattijs Korpershoek @ 2025-04-14 12:24 UTC (permalink / raw)
To: Vincent Stehlé, u-boot
Cc: Vincent Stehlé, Jassi Brar, Marek Vasut, Masahisa Kojima,
Michal Simek, Patrice Chotard, Patrick Delaunay, Tom Rini,
uboot-stm32
Hi Vincent,
Thank you for the patch.
On lun., avril 07, 2025 at 19:05, Vincent Stehlé <vincent.stehle@arm.com> 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>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
> ---
> 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);
> --
> 2.47.2
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 2/5] board: st: common: fix dfu alt buffer clearing
2025-04-14 12:24 ` Mattijs Korpershoek
@ 2025-04-14 12:35 ` Mattijs Korpershoek
0 siblings, 0 replies; 18+ messages in thread
From: Mattijs Korpershoek @ 2025-04-14 12:35 UTC (permalink / raw)
To: Mattijs Korpershoek, Vincent Stehlé, u-boot
Cc: Vincent Stehlé, Jassi Brar, Marek Vasut, Masahisa Kojima,
Michal Simek, Patrice Chotard, Patrick Delaunay, Tom Rini,
uboot-stm32
On lun., avril 14, 2025 at 14:24, Mattijs Korpershoek <mkorpershoek@kernel.org> wrote:
> Hi Vincent,
>
> Thank you for the patch.
>
> On lun., avril 07, 2025 at 19:05, Vincent Stehlé <vincent.stehle@arm.com> 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>
>
> Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Patrice, Patrick,
This was assigned to me on patchwork. As [3-5] have been applied already
by Michal, could you please pick this up?
I've assigned it to Patrice on patchwork.
>
>> ---
>> 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);
>> --
>> 2.47.2
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 2/5] board: st: common: fix dfu alt buffer clearing
2025-04-07 17:05 ` [PATCH 2/5] board: st: common: " Vincent Stehlé
2025-04-14 12:24 ` Mattijs Korpershoek
@ 2025-04-22 7:32 ` Patrice CHOTARD
2025-05-05 13:28 ` Patrice CHOTARD
1 sibling, 1 reply; 18+ messages in thread
From: Patrice CHOTARD @ 2025-04-22 7:32 UTC (permalink / raw)
To: Vincent Stehlé, u-boot
Cc: Jassi Brar, Marek Vasut, Masahisa Kojima, Michal Simek,
Patrick Delaunay, Tom Rini, uboot-stm32
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
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 2/5] board: st: common: fix dfu alt buffer clearing
2025-04-22 7:32 ` Patrice CHOTARD
@ 2025-05-05 13:28 ` Patrice CHOTARD
0 siblings, 0 replies; 18+ messages in thread
From: Patrice CHOTARD @ 2025-05-05 13:28 UTC (permalink / raw)
To: Vincent Stehlé, u-boot
Cc: Jassi Brar, Marek Vasut, Masahisa Kojima, Michal Simek,
Patrick Delaunay, Tom Rini, uboot-stm32
On 4/22/25 09:32, Patrice CHOTARD wrote:
>
>
> 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
Applied to u-boot-stm32/master
Thanks
Patrice
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 3/5] arm64: versal: fix dfu alt buffer clearing
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-07 17:05 ` [PATCH 2/5] board: st: common: " Vincent Stehlé
@ 2025-04-07 17:05 ` 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é
` (2 subsequent siblings)
5 siblings, 2 replies; 18+ messages in thread
From: Vincent Stehlé @ 2025-04-07 17:05 UTC (permalink / raw)
To: u-boot
Cc: Vincent Stehlé, Jassi Brar, Marek Vasut, Masahisa Kojima,
Michal Simek, Patrice Chotard, Patrick Delaunay, Tom Rini
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: 064c8978b44f ("arm64: versal: Enable capsule update (SD)")
Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Tom Rini <trini@konsulko.com>
---
board/xilinx/versal/board.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c
index b4483d00ad1..3edccc979d8 100644
--- a/board/xilinx/versal/board.c
+++ b/board/xilinx/versal/board.c
@@ -396,7 +396,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);
multiboot = env_get_hex("multiboot", multiboot);
--
2.47.2
^ permalink raw reply related [flat|nested] 18+ messages in thread* RE: [PATCH 3/5] arm64: versal: fix dfu alt buffer clearing
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
1 sibling, 0 replies; 18+ messages in thread
From: Begari, Padmarao @ 2025-04-11 3:56 UTC (permalink / raw)
To: Vincent Stehlé, u-boot@lists.denx.de
Cc: Jassi Brar, Marek Vasut, Masahisa Kojima, Simek, Michal,
Patrice Chotard, Patrick Delaunay, Tom Rini
[AMD Official Use Only - AMD Internal Distribution Only]
> From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Vincent Stehlé
> Sent: Monday, April 7, 2025 10:35 PM
> To: u-boot@lists.denx.de
> Cc: Vincent Stehlé <vincent.stehle@arm.com>; Jassi Brar
> <jaswinder.singh@linaro.org>; Marek Vasut <marex@denx.de>; Masahisa Kojima
> <kojima.masahisa@socionext.com>; Simek, Michal <michal.simek@amd.com>;
> Patrice Chotard <patrice.chotard@foss.st.com>; Patrick Delaunay
> <patrick.delaunay@foss.st.com>; Tom Rini <trini@konsulko.com>
> Subject: [PATCH 3/5] arm64: versal: fix dfu alt buffer clearing
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> 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: 064c8978b44f ("arm64: versal: Enable capsule update (SD)")
> Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
> Cc: Michal Simek <michal.simek@amd.com>
> Cc: Tom Rini <trini@konsulko.com>
Acked-by: Padmarao Begari <padmarao.begari@amd.com>
> ---
> board/xilinx/versal/board.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c index
> b4483d00ad1..3edccc979d8 100644
> --- a/board/xilinx/versal/board.c
> +++ b/board/xilinx/versal/board.c
> @@ -396,7 +396,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);
>
> multiboot = env_get_hex("multiboot", multiboot);
>
> --
> 2.47.2
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 3/5] arm64: versal: fix dfu alt buffer clearing
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
1 sibling, 0 replies; 18+ messages in thread
From: Michal Simek @ 2025-04-14 6:28 UTC (permalink / raw)
To: Vincent Stehlé, u-boot
Cc: Jassi Brar, Marek Vasut, Masahisa Kojima, Patrice Chotard,
Patrick Delaunay, Tom Rini
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: 064c8978b44f ("arm64: versal: Enable capsule update (SD)")
> Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
> Cc: Michal Simek <michal.simek@amd.com>
> Cc: Tom Rini <trini@konsulko.com>
> ---
> board/xilinx/versal/board.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c
> index b4483d00ad1..3edccc979d8 100644
> --- a/board/xilinx/versal/board.c
> +++ b/board/xilinx/versal/board.c
> @@ -396,7 +396,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);
>
> multiboot = env_get_hex("multiboot", multiboot);
>
Applied.
M
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 4/5] xilinx: zynq: fix dfu alt buffer clearing
2025-04-07 17:05 [PATCH 0/5] fix dfu alt buffer clearing Vincent Stehlé
` (2 preceding siblings ...)
2025-04-07 17:05 ` [PATCH 3/5] arm64: versal: " Vincent Stehlé
@ 2025-04-07 17:05 ` 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-23 7:53 ` (subset) [PATCH 0/5] " Mattijs Korpershoek
5 siblings, 2 replies; 18+ messages in thread
From: Vincent Stehlé @ 2025-04-07 17:05 UTC (permalink / raw)
To: u-boot
Cc: Vincent Stehlé, Jassi Brar, Marek Vasut, Masahisa Kojima,
Michal Simek, Patrice Chotard, Patrick Delaunay, Tom Rini
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: c67fecd2125b ("ARM: zynq: Enable capsule update for qspi and mmc")
Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Tom Rini <trini@konsulko.com>
---
board/xilinx/zynq/board.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c
index 8dbfa560423..d8d4d5022ae 100644
--- a/board/xilinx/zynq/board.c
+++ b/board/xilinx/zynq/board.c
@@ -176,7 +176,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);
switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
#if defined(CONFIG_SPL_FS_LOAD_PAYLOAD_NAME)
--
2.47.2
^ permalink raw reply related [flat|nested] 18+ messages in thread* RE: [PATCH 4/5] xilinx: zynq: fix dfu alt buffer clearing
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
1 sibling, 0 replies; 18+ messages in thread
From: Begari, Padmarao @ 2025-04-11 3:57 UTC (permalink / raw)
To: Vincent Stehlé, u-boot@lists.denx.de
Cc: Jassi Brar, Marek Vasut, Masahisa Kojima, Simek, Michal,
Patrice Chotard, Patrick Delaunay, Tom Rini
[AMD Official Use Only - AMD Internal Distribution Only]
> From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Vincent Stehlé
> Sent: Monday, April 7, 2025 10:35 PM
> To: u-boot@lists.denx.de
> Cc: Vincent Stehlé <vincent.stehle@arm.com>; Jassi Brar
> <jaswinder.singh@linaro.org>; Marek Vasut <marex@denx.de>; Masahisa Kojima
> <kojima.masahisa@socionext.com>; Simek, Michal <michal.simek@amd.com>;
> Patrice Chotard <patrice.chotard@foss.st.com>; Patrick Delaunay
> <patrick.delaunay@foss.st.com>; Tom Rini <trini@konsulko.com>
> Subject: [PATCH 4/5] xilinx: zynq: fix dfu alt buffer clearing
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> 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: c67fecd2125b ("ARM: zynq: Enable capsule update for qspi and mmc")
> Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
> Cc: Michal Simek <michal.simek@amd.com>
> Cc: Tom Rini <trini@konsulko.com>
Acked-by: Padmarao Begari <padmarao.begari@amd.com>
> ---
> board/xilinx/zynq/board.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index
> 8dbfa560423..d8d4d5022ae 100644
> --- a/board/xilinx/zynq/board.c
> +++ b/board/xilinx/zynq/board.c
> @@ -176,7 +176,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);
>
> switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) { #if
> defined(CONFIG_SPL_FS_LOAD_PAYLOAD_NAME)
> --
> 2.47.2
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 4/5] xilinx: zynq: fix dfu alt buffer clearing
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
1 sibling, 0 replies; 18+ messages in thread
From: Michal Simek @ 2025-04-14 6:28 UTC (permalink / raw)
To: Vincent Stehlé, u-boot
Cc: Jassi Brar, Marek Vasut, Masahisa Kojima, Patrice Chotard,
Patrick Delaunay, Tom Rini
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: c67fecd2125b ("ARM: zynq: Enable capsule update for qspi and mmc")
> Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
> Cc: Michal Simek <michal.simek@amd.com>
> Cc: Tom Rini <trini@konsulko.com>
> ---
> board/xilinx/zynq/board.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c
> index 8dbfa560423..d8d4d5022ae 100644
> --- a/board/xilinx/zynq/board.c
> +++ b/board/xilinx/zynq/board.c
> @@ -176,7 +176,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);
>
> switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
> #if defined(CONFIG_SPL_FS_LOAD_PAYLOAD_NAME)
Applied.
M
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 5/5] arm64: zynqmp: fix dfu alt buffer clearing
2025-04-07 17:05 [PATCH 0/5] fix dfu alt buffer clearing Vincent Stehlé
` (3 preceding siblings ...)
2025-04-07 17:05 ` [PATCH 4/5] xilinx: zynq: " Vincent Stehlé
@ 2025-04-07 17:05 ` 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
5 siblings, 2 replies; 18+ messages in thread
From: Vincent Stehlé @ 2025-04-07 17:05 UTC (permalink / raw)
To: u-boot
Cc: Vincent Stehlé, Jassi Brar, Marek Vasut, Masahisa Kojima,
Michal Simek, Patrice Chotard, Patrick Delaunay, Tom Rini
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: b86f43de0be0 ("xilinx: zynqmp: Add support for runtime dfu_alt_info setup")
Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
Cc: Michal Simek <michal.simek@amd.com>
Cc: Tom Rini <trini@konsulko.com>
---
board/xilinx/zynqmp/zynqmp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 820fb252a3f..687dcd3ac9d 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -669,7 +669,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);
multiboot = multi_boot();
if (multiboot < 0)
--
2.47.2
^ permalink raw reply related [flat|nested] 18+ messages in thread* RE: [PATCH 5/5] arm64: zynqmp: fix dfu alt buffer clearing
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
1 sibling, 0 replies; 18+ messages in thread
From: Begari, Padmarao @ 2025-04-11 3:57 UTC (permalink / raw)
To: Vincent Stehlé, u-boot@lists.denx.de
Cc: Jassi Brar, Marek Vasut, Masahisa Kojima, Simek, Michal,
Patrice Chotard, Patrick Delaunay, Tom Rini
[AMD Official Use Only - AMD Internal Distribution Only]
> From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Vincent Stehlé
> Sent: Monday, April 7, 2025 10:35 PM
> To: u-boot@lists.denx.de
> Cc: Vincent Stehlé <vincent.stehle@arm.com>; Jassi Brar
> <jaswinder.singh@linaro.org>; Marek Vasut <marex@denx.de>; Masahisa Kojima
> <kojima.masahisa@socionext.com>; Simek, Michal <michal.simek@amd.com>;
> Patrice Chotard <patrice.chotard@foss.st.com>; Patrick Delaunay
> <patrick.delaunay@foss.st.com>; Tom Rini <trini@konsulko.com>
> Subject: [PATCH 5/5] arm64: zynqmp: fix dfu alt buffer clearing
>
> Caution: This message originated from an External Source. Use proper caution
> when opening attachments, clicking links, or responding.
>
>
> 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: b86f43de0be0 ("xilinx: zynqmp: Add support for runtime dfu_alt_info setup")
> Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
> Cc: Michal Simek <michal.simek@amd.com>
> Cc: Tom Rini <trini@konsulko.com>
Acked-by: Padmarao Begari <padmarao.begari@amd.com>
> ---
> board/xilinx/zynqmp/zynqmp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index
> 820fb252a3f..687dcd3ac9d 100644
> --- a/board/xilinx/zynqmp/zynqmp.c
> +++ b/board/xilinx/zynqmp/zynqmp.c
> @@ -669,7 +669,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);
>
> multiboot = multi_boot();
> if (multiboot < 0)
> --
> 2.47.2
^ permalink raw reply [flat|nested] 18+ messages in thread* Re: [PATCH 5/5] arm64: zynqmp: fix dfu alt buffer clearing
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
1 sibling, 0 replies; 18+ messages in thread
From: Michal Simek @ 2025-04-14 6:29 UTC (permalink / raw)
To: Vincent Stehlé, u-boot
Cc: Jassi Brar, Marek Vasut, Masahisa Kojima, Patrice Chotard,
Patrick Delaunay, Tom Rini
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: b86f43de0be0 ("xilinx: zynqmp: Add support for runtime dfu_alt_info setup")
> Signed-off-by: Vincent Stehlé <vincent.stehle@arm.com>
> Cc: Michal Simek <michal.simek@amd.com>
> Cc: Tom Rini <trini@konsulko.com>
> ---
> board/xilinx/zynqmp/zynqmp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
> index 820fb252a3f..687dcd3ac9d 100644
> --- a/board/xilinx/zynqmp/zynqmp.c
> +++ b/board/xilinx/zynqmp/zynqmp.c
> @@ -669,7 +669,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);
>
> multiboot = multi_boot();
> if (multiboot < 0)
Applied.
M
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: (subset) [PATCH 0/5] fix dfu alt buffer clearing
2025-04-07 17:05 [PATCH 0/5] fix dfu alt buffer clearing Vincent Stehlé
` (4 preceding siblings ...)
2025-04-07 17:05 ` [PATCH 5/5] arm64: zynqmp: " Vincent Stehlé
@ 2025-04-23 7:53 ` Mattijs Korpershoek
5 siblings, 0 replies; 18+ messages in thread
From: Mattijs Korpershoek @ 2025-04-23 7:53 UTC (permalink / raw)
To: u-boot, Vincent Stehlé
Cc: Jassi Brar, Marek Vasut, Masahisa Kojima, Michal Simek,
Patrice Chotard, Patrick Delaunay, Tom Rini
Hi,
On Mon, 07 Apr 2025 19:05:24 +0200, Vincent Stehlé wrote:
> This patch series applies the same fix in five different locations (the
> detailed description of the fix is in the patches).
>
> I did validate statically by looking at the assembly before/after for all
> five cases, using the following defconfigs:
>
> stm32mp15_defconfig
> synquacer_developerbox_defconfig
> xilinx_versal_virt_defconfig
> xilinx_zynq_virt_defconfig
> xilinx_zynqmp_kria_defconfig
>
> [...]
Thanks, Applied to https://source.denx.de/u-boot/custodians/u-boot-dfu (u-boot-dfu)
[1/5] fwu: developerbox: fix dfu alt buffer clearing
https://source.denx.de/u-boot/custodians/u-boot-dfu/-/commit/39a719dce59607d6abcac17cc2683aa9f2162539
--
Mattijs
^ permalink raw reply [flat|nested] 18+ messages in thread