U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Vincent Stehlé" <vincent.stehle@arm.com>
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>,
	"Michal Simek" <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
Date: Mon,  7 Apr 2025 19:05:29 +0200	[thread overview]
Message-ID: <20250407170529.893307-6-vincent.stehle@arm.com> (raw)
In-Reply-To: <20250407170529.893307-1-vincent.stehle@arm.com>

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


  parent reply	other threads:[~2025-04-07 17:06 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
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 ` Vincent Stehlé [this message]
2025-04-11  3:57   ` [PATCH 5/5] arm64: zynqmp: " 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=20250407170529.893307-6-vincent.stehle@arm.com \
    --to=vincent.stehle@arm.com \
    --cc=jaswinder.singh@linaro.org \
    --cc=kojima.masahisa@socionext.com \
    --cc=marex@denx.de \
    --cc=michal.simek@amd.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=patrick.delaunay@foss.st.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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