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 0E325C7EE23 for ; Thu, 2 Mar 2023 03:18:26 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 41E1E85C18; Thu, 2 Mar 2023 04:18:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=mailbox.org 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; secure) header.d=mailbox.org header.i=@mailbox.org header.b="SxABPOeN"; dkim=pass (2048-bit key) header.d=mailbox.org header.i=@mailbox.org header.b="dqkiur4I"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BF20B85B81; Thu, 2 Mar 2023 04:18:22 +0100 (CET) Received: from mout-p-101.mailbox.org (mout-p-101.mailbox.org [IPv6:2001:67c:2050:0:465::101]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1EB1A85C4D for ; Thu, 2 Mar 2023 04:18:20 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=reject dis=none) header.from=mailbox.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=marek.vasut@mailbox.org Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4PRxBd6RNPz9sgK; Thu, 2 Mar 2023 04:18:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1677727097; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9xiUCMwUWRCfFWnwOQdXsD7juJBp87hoZen9tSYIRDA=; b=SxABPOeN4igwkFhFeZi5z/TcHU+B626/hIxNZyzOgo36SgnZuktkniRffN7FoVwGxZnrFx Uogw43kyQ1EZW2r9Yw0fCcDwS5kAwD6XxZo3I2kQP9Cx9PFz13hQcvu7OefLhOhoKbctPT 2/DazqJeooZMrxYXQOMPUpNdJfa8PgQir9j+/HXUI1iph7nhukoXZjixFg6ojGhuySKVUd DbfjpIm3NCiB4RQv91/+4JyQ3YZx9BOxNyyYCds8ytdR+QyjnHyeBq9oKEIZ6zO1pc8VJX OkedTrLief2euFiuR14BjDgwKW2a1zx6Sj2axiZzvNja0Vt7WtdoEwPzZppUPw== Message-ID: <3f3196e4-3fd3-5ba6-3c90-eb8436b3773a@mailbox.org> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1677727095; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9xiUCMwUWRCfFWnwOQdXsD7juJBp87hoZen9tSYIRDA=; b=dqkiur4I5OdFRnxtFAMvCIlsUUJf5BNTzxpv9bRnkaqAZyVwCS2n7LZ2dVxeE6eq4/JdCL bv33hG3pcsCnV/+FqQXsDf4sdT2Nj1RE8qCdM7xKL+H6i4i9U+o+xTwZupMHRc335t+H4F +MWwNXPCdhJBZnk8pIXk9R+NnVJIBrlFkU/TvJWLgbxFPExzCtP45Bk4+WNFVP6y08zZyY 9C/i1dGCZ25dRhnRTJkjZLKcn0mrvrJhKqf7c2GWFpwAsv7vDQQHGKth0vIKyEjUDmi5tq xCcJwyhBN+lsEXNAxW1IQvjz+E4viI5RVegIS0kzIumLiV/uYd8OtlKvwKd9Zw== Date: Thu, 2 Mar 2023 04:18:14 +0100 MIME-Version: 1.0 Subject: Re: [PATCH] image: Fix potentially uninitialized data variable Content-Language: en-US To: Tom Rini , Marek Vasut Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Michal Simek , Oleksandr Suvorov , Simon Glass , Stefan Roese References: <20230227195631.98868-1-marek.vasut+renesas@mailbox.org> From: Marek Vasut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-MBO-RS-ID: 6dc05c6704042952eb2 X-MBO-RS-META: rnxk3h3w7ig1iim6c55rqcfh3qqps5xm X-Rspamd-Queue-Id: 4PRxBd6RNPz9sgK 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.6 at phobos.denx.de X-Virus-Status: Clean On 3/1/23 17:02, Tom Rini wrote: > On Mon, Feb 27, 2023 at 08:56:31PM +0100, Marek Vasut wrote: > >> In case fitImage support is disabled, and image_locate_script() is >> passed a fitImage, then the 'data' variable is used uninitialized. >> Drop into the default: branch of the switch-case statement and do >> not return the uninitialized data, and do not modify the return >> pointer either, just print an error message. >> >> Reported by clang build: >> " >> $ make HOSTCC=clang CC=clang KCFLAGS=-Werror sandbox64_defconfig && make HOSTCC=clang CC=clang KCFLAGS=-Werror >> ... >> boot/image-board.c:1006:7: error: variable 'data' is used uninitialized whenever switch case is taken [-Werror,-Wsometimes-uninitialized] >> case IMAGE_FORMAT_LEGACY: >> ^~~~~~~~~~~~~~~~~~~ >> include/image.h:608:29: note: expanded from macro 'IMAGE_FORMAT_LEGACY' >> ^~~~ >> boot/image-board.c:1128:19: note: uninitialized use occurs here >> *datap = (char *)data; >> ^~~~ >> boot/image-board.c:1001:11: note: initialize the variable 'data' to silence this warning >> u32 *data; >> ^ >> = NULL >> " >> >> Signed-off-by: Marek Vasut > > Reviewed-by: Tom Rini > > And can you please do a follow-up that adds sandbox64 + clang, after the > sandbox + clang test in GitLab/Azure? The CI is chewing on it here: ahttps://source.denx.de/u-boot/custodians/u-boot-sh/-/commit/f80a434c2ea4fdae7adf0e4c4a0ecd9784d6808e