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 7BE72C76196 for ; Fri, 31 Mar 2023 14:20:50 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 610FB860BE; Fri, 31 Mar 2023 16:19:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="Ynasjfc2"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8357D85F9B; Fri, 31 Mar 2023 16:16:24 +0200 (CEST) Received: from mail-yw1-x112d.google.com (mail-yw1-x112d.google.com [IPv6:2607:f8b0:4864:20::112d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1AA5685FD3 for ; Fri, 31 Mar 2023 16:16:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-yw1-x112d.google.com with SMTP id 00721157ae682-544787916d9so416702517b3.13 for ; Fri, 31 Mar 2023 07:16:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1680272171; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=EkwJDtWiX8GylJsgyPUuA9TpCaa4ycBk8YgiECN1Ukg=; b=Ynasjfc2cRlobWrzbZq5usTZi/2UMYcctoSQAceKdP/VQELXdTVotgLFf/Ht7jIPFs zStIuLHBUc1K1ZSs512rrG7tXZsMN8P6E/Jri0x5OMiFwMnr/gK5HE4WhjgjvLBWyoe1 LkTHkhzozCoCJuOvyWIh8TsdIolcgM3uSkGos= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680272171; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=EkwJDtWiX8GylJsgyPUuA9TpCaa4ycBk8YgiECN1Ukg=; b=QHdAVeCcrW6NsEYs1A7lIeW1VkYjZpzhyUcXlE8vvXCqmDCz0koSMTHxu/9TVcJBgN 30zgMCmlPjzkizFJTUkabO/Q9D9fPfmzGOlKDfURQ1hgqETe73s7rtVKVF1NxFrpa3ma mzHrJNR75Hod+iOuzuUvntslx1uE+RWFPSTAY+ZpRt2njgJB878ZjB6OfnZxVzbXFZmr WaQ2UF5loFquR/lxUuSnRhU8TI6/Fp1oEZjqpUNuwvZr6L7P3JHpAn5cAFYGBPve3Um0 ovspdvh7M98jMrs8+5bHlKKiG8r26nJUlheHhOcAhdW1PpTjVq7x12enHYfQRAkVNps3 Z6mA== X-Gm-Message-State: AAQBX9fgVq40/+gMP78fIt77CphKZn5FNpluk8iscYk2mCmGVOxH022z FqXGCm+OJODj6jG4dA1rdTHerw== X-Google-Smtp-Source: AKy350YwH4RVr36nJvUS+tkjzOAxFxxFhZOYkp5WVeQcBGpi9l3M6DOR+IDhzNoruDm/v0b5GyvupQ== X-Received: by 2002:a0d:cb45:0:b0:538:4f61:494e with SMTP id n66-20020a0dcb45000000b005384f61494emr23805738ywd.47.1680272171542; Fri, 31 Mar 2023 07:16:11 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b00-6400-1500-2834-9def-41f1.res6.spectrum.com. [2603:6081:7b00:6400:1500:2834:9def:41f1]) by smtp.gmail.com with ESMTPSA id m23-20020a81ae17000000b00545a0818475sm555874ywh.5.2023.03.31.07.16.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 Mar 2023 07:16:11 -0700 (PDT) Date: Fri, 31 Mar 2023 10:16:09 -0400 From: Tom Rini To: Marek Vasut Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Michal Simek , Oleksandr Suvorov , Simon Glass , Stefan Roese Subject: Re: [PATCH] image: Fix potentially uninitialized data variable Message-ID: <20230331141609.GL13222@bill-the-cat> References: <20230227195631.98868-1-marek.vasut+renesas@mailbox.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="0uIMRfxDO7yXAj8X" Content-Disposition: inline In-Reply-To: <20230227195631.98868-1-marek.vasut+renesas@mailbox.org> X-Clacks-Overhead: GNU Terry Pratchett 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 --0uIMRfxDO7yXAj8X Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > Reported by clang build: > " > $ make HOSTCC=3Dclang CC=3Dclang KCFLAGS=3D-Werror sandbox64_defconfig &&= make HOSTCC=3Dclang CC=3Dclang KCFLAGS=3D-Werror > ... > boot/image-board.c:1006:7: error: variable 'data' is used uninitialized w= henever 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 =3D (char *)data; > ^~~~ > boot/image-board.c:1001:11: note: initialize the variable 'data' to silen= ce this warning > u32 *data; > ^ > =3D NULL > " >=20 > Signed-off-by: Marek Vasut > Reviewed-by: Tom Rini > Reviewed-by: Simon Glass Applied to u-boot/next, thanks! --=20 Tom --0uIMRfxDO7yXAj8X Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmQm6ykACgkQFHw5/5Y0 tyykkQwAjorIi1KJ27mYXYIswSs6tu0wxGlDAUDN1UCVeQQnI/hDhBZig5NNOXSW FCNRgCNAaF63/yXNIyWeDwywiboHp5pJwWFzqrM3VEWhkTPVar3WHuzr3Q9ihpD7 SQ5FnmF+xpUTgKY6CilmFcOwYHBzzfWaBnyuKHrPXteSHJBOeT9fEs51iKKsvey4 YJjbkTr64XtBg8UnBSPJj2G0MqLgxSH64FzTrnKmDi1Rx6ilMszRZyQk+aVCnh21 8d8sK7Y18DI6aHtsbFOxBbGqv2ATv3eNK1WQnHsSAH+YilAa+WJzO32e9S1Mfil8 NjKcla7xQUgJrlFVezh1m07290s12tKuUFSRJBXMvrhAg/igR5OfI6CdDMeLeovn mUZ4NEuqVCwvxUbXj9kvt325NmfganQ1I73ATDkGFdScypIN96YH4Q3X15kqymz6 2XmK4vyIg70k43/BaVNhfMPSQlEL1zx2jblCV7WLpgSBQJ3TwTV22V86LW1sX3hs fyjcfVEP =qOBB -----END PGP SIGNATURE----- --0uIMRfxDO7yXAj8X--