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 298B3C64ED6 for ; Wed, 1 Mar 2023 16:02:34 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 625AA85950; Wed, 1 Mar 2023 17:02:31 +0100 (CET) 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="OT7Be9E9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BCAF485AFF; Wed, 1 Mar 2023 17:02:28 +0100 (CET) Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) (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 EA51785637 for ; Wed, 1 Mar 2023 17:02:25 +0100 (CET) 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-qt1-x831.google.com with SMTP id l18so13691733qtp.1 for ; Wed, 01 Mar 2023 08:02:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; t=1677686544; 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=v4EW35BvhoqnUQ/67HxOBO5t4MfyiZ/xY2hQnX1VE9E=; b=OT7Be9E9jDgQz3fs8LSstw07lFVyJi+DHN+JnqLbD68MYv6z39RC0B81yP+cpEf3o9 rgJylXq1i+CCmnZfioCpMO8h8vI2UwD2IScFMfzhdtnCsMvw0wxRbj60Q//ByNHq/Fco dcuZRAjojGwm37cqUKXz2gnicOjFBVSXNHaFk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677686544; 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=v4EW35BvhoqnUQ/67HxOBO5t4MfyiZ/xY2hQnX1VE9E=; b=1kN2a16tNTmHXfDnkuGAJ0OFjpxFaIBHhmEmYLhFXbSFXKzKRX8T55MG8bgmY6ma5u aYplf3VIJLJlERpbijuDVsuBGYKV+ZgQv2rWnRRVJ4hrFsIyIa7x6NT67m5/oIKs6Cfs Mc4qp85t862P0i+kEKeGihBph1McsXS658cwVJL7rTc2rzN29pztRI8/GRTn53MDdCV8 HRKnEQPYvLS1BWOawGHV7JY2tY9gJJXfOTx77pbGzsXQ/yO+0fqwtiyn6LsFVMZHUUv7 gA6oMcT4vBblddEqbpcy9N6LGXi5cq9VQtJ98s+08OfNGSfuRh650NT7XQMW5CKv2FNN c2PQ== X-Gm-Message-State: AO0yUKXtiK67FNRLW5uYlPBu4MdnMPfQP+3Qv50REM9PqRImlcvolbpe 2rh1xlbVdxiJc8mgpkX0zwLzvg== X-Google-Smtp-Source: AK7set8dcaDj/m2DvIcEt3kgfurv8YlYkDuhgh/J9mQrPB2+ER62g5P81GukLoiXbWBrkVs7VoP2RQ== X-Received: by 2002:ac8:5885:0:b0:3bf:c355:9ad4 with SMTP id t5-20020ac85885000000b003bfc3559ad4mr12379485qta.34.1677686544683; Wed, 01 Mar 2023 08:02:24 -0800 (PST) Received: from bill-the-cat (2603-6081-7b00-6400-0000-0000-0000-036b.res6.spectrum.com. [2603:6081:7b00:6400::36b]) by smtp.gmail.com with ESMTPSA id y141-20020a376493000000b00706c1f7a608sm9098156qkb.89.2023.03.01.08.02.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Mar 2023 08:02:24 -0800 (PST) Date: Wed, 1 Mar 2023 11:02:22 -0500 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: 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="461BVa+KhCiQobH+" 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.6 at phobos.denx.de X-Virus-Status: Clean --461BVa+KhCiQobH+ 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 And can you please do a follow-up that adds sandbox64 + clang, after the sandbox + clang test in GitLab/Azure? --=20 Tom --461BVa+KhCiQobH+ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmP/dw4ACgkQFHw5/5Y0 tyzDBAv+PEVfPmVVoDCt49ZldTqSzb4mnYs50fVr2f3kpUk1Kej1vPEn0zVfXeGT it3m93PyGi3im08fHyllDOCBk/bveEE8WyAV9VpuHRTTh/kBzAoL16BcfrC96lEr plGgdmiizdLUW+ZyX93UIFIW2wOf28j0ayP0hWQOadc+k4sUPhslJduLe54bVNuP hL4zOFxkqiWGznpv6aT79DfZSuinMKXtJrJ42JdSMK796g66WFzzq/rdzNZAMvv3 eP5He9Aagrp0Jbf7ayGpjEbp9u7VuPkf/OaGpA3dMuegcncu9urs9x25vtJFnTKd 9shB4xypIqePkziftCYNKROJRZLN3nx0zFFziEbDviiwmf832WdcvgYutn+tvvXs kJ3PB0ZGfCQeYfLothIacRlKUBFEWPJAS9DyxSbZywoJAFD2uzRl+UBkXxIwvD3I SRXuAQHzd95ADhWB+AfGnIWIOn2P0T0LOXGfA8NhDESBzjoiEnuAgisLuhRZ7mbC pp6cM7gn =URNu -----END PGP SIGNATURE----- --461BVa+KhCiQobH+--