From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5DA7DC369CB for ; Tue, 22 Apr 2025 07:34:12 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C072181026; Tue, 22 Apr 2025 09:34:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=foss.st.com header.i=@foss.st.com header.b="jDyPXzUT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3E330810E8; Tue, 22 Apr 2025 09:34:09 +0200 (CEST) Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [185.132.182.106]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2219F80FEC for ; Tue, 22 Apr 2025 09:34:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=prvs=6207ada5ad=patrice.chotard@foss.st.com Received: from pps.filterd (m0241204.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 53M6uxGC025914; Tue, 22 Apr 2025 09:33:57 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=selector1; bh= Q6JnMBhdQ8eCM5gU1rctVgN5bEImPk63D7ScnGyAwco=; b=jDyPXzUTrXUc23rv TwY8HQ4MDPGjmq+7Wk/ePcDZ9bHTkEiW53edpe7jcy1oD1peJJhgYbNRTFJC0BNh uiMrYr8RQlcBM7kTMlJiG1Sz1T/xGI4l3xawHlaU6WdjFLmuUCsVKDnNPrSxo5uy 81yN7/1aGnqluZ2S28m9zdAHiM+VpEf/wLH/JtH4Ub3G3HnNs3jkN7uAKgkNnayk lh/83kyN3T9a1wT68UkyxOqc4uhCamwXVwz3xpWnvG4QkUA54k1r78zPK/dy2Bqa bG+ELjWG1ihIk45yhois++PlDM8Y50dIG5wxvTlCASqEoPF7p846CVyKmVDYdaqz kC/ydQ== Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 4643628vg6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 22 Apr 2025 09:33:57 +0200 (MEST) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id DE12240049; Tue, 22 Apr 2025 09:32:47 +0200 (CEST) Received: from Webmail-eu.st.com (shfdag1node1.st.com [10.75.129.69]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 2FE889A7575; Tue, 22 Apr 2025 09:32:14 +0200 (CEST) Received: from [10.48.87.62] (10.48.87.62) by SHFDAG1NODE1.st.com (10.75.129.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Tue, 22 Apr 2025 09:32:13 +0200 Message-ID: <0e7b0b06-d100-4db5-aa84-9eb9767f4e0d@foss.st.com> Date: Tue, 22 Apr 2025 09:32:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/5] board: st: common: fix dfu alt buffer clearing To: =?UTF-8?Q?Vincent_Stehl=C3=A9?= , CC: Jassi Brar , Marek Vasut , Masahisa Kojima , Michal Simek , Patrick Delaunay , Tom Rini , References: <20250407170529.893307-1-vincent.stehle@arm.com> <20250407170529.893307-3-vincent.stehle@arm.com> Content-Language: en-US From: Patrice CHOTARD In-Reply-To: <20250407170529.893307-3-vincent.stehle@arm.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.48.87.62] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE1.st.com (10.75.129.69) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1095,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-04-22_04,2025-04-21_02,2024-11-22_01 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean 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é > Cc: Patrick Delaunay > Cc: Patrice Chotard > Cc: Tom Rini > Cc: Marek Vasut > --- > 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 Thanks