From patchwork Thu Jul 4 12:49:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 809958 Delivered-To: patch@linaro.org Received: by 2002:adf:a199:0:b0:367:895a:4699 with SMTP id u25csp1149252wru; Thu, 4 Jul 2024 05:50:34 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU/pmZy72V1gQ675jkF0OJ9f2dwemto/w71W92VOUxZ8+G3tJKvir1PAxlx6adM2thvct6Q1aR58SWDHC0thhZt X-Google-Smtp-Source: AGHT+IFArVLJQMx1TVkcPhfX97TV723g3u4ou931ywp+RdFwj2kQac2xGK9ZHbCYIS3Q+dcx51U+ X-Received: by 2002:a9d:6499:0:b0:700:e0e8:5c3 with SMTP id 46e09a7af769-7034a81e473mr1673716a34.34.1720097434247; Thu, 04 Jul 2024 05:50:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1720097434; cv=none; d=google.com; s=arc-20160816; b=g+sqDmWJBqdq3t7yT/sxjRqEXMziCYeNELjKdEnJummzmQIIJLGfI9IUHUhHBtsLR+ Bgsf5xNmLEuUAHWApusYMSqNqbefEtCdfmWgvU+Nug/ZAeKiebFF3dVpIgLNFC+W7pYp sGLrKc+AUW5g/k4Oz7ea8PXv1F4NWPlvm+rIQBdgImtGgEeN5Iqk7FFBIAl8zubqgrb5 EJr+ZQK7OGs5zTxwRiBcMlBuV67+/nquXUQYhHcBCgwt4btqfhxsKPuZ3on4ALB+MGNZ HCMgQq+55A9Pp1LUZ6/faH4TNWDXYhBdNJRjnlfKVxBwj27TO8KHIcvg+WFuutNxV3dn Oe4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=mE9NVMNgeMpdIBYLHPdIh0Aogurvyr2VaxgmAxGfLmI=; fh=2oOCyG7mkIpVgeBF46+chx1bjHnQD8F1jAubE3MpSd4=; b=OI/XtIxKrOQkwNuoQdn+jIBoC3vQ1M0EjrhCiCk92PLxa5R93Ocn5ZkDTk6CSqsWno CuYlumpMHcebSVCdHl0gQncOSG+9k5dJfwhZay9Lk8SUY13ou4NIeBzc0rmTmQKzUG5i VinohE4CDxfe+wL3AjsYXP8pswLc14AZELF/1Tf4iShEsaSnwgSFo5DqDvfW+FCJx1Gm 11Q5DohZFhGLmMsOcmGT5kjZlyqWoWI/gylxmFOu8ujae5DF4SilqHG3/gRyFd7FcKFU P21O3o/Dg0V5ltCEgShfyQSo9Rt483r6eJSl8UZitwJcBGNADdcp+vFfH4z4IT4F5Qgx q4Fg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TyHQbsYx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id af79cd13be357-79d692f0336si1462702585a.338.2024.07.04.05.50.34 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Jul 2024 05:50:34 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TyHQbsYx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sPLuJ-0005i1-53; Thu, 04 Jul 2024 08:49:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sPLtm-0004gc-Tw for qemu-devel@nongnu.org; Thu, 04 Jul 2024 08:49:19 -0400 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sPLti-0006WE-HQ for qemu-devel@nongnu.org; Thu, 04 Jul 2024 08:49:18 -0400 Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-58c2e5e8649so2633125a12.1 for ; Thu, 04 Jul 2024 05:49:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1720097353; x=1720702153; darn=nongnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=mE9NVMNgeMpdIBYLHPdIh0Aogurvyr2VaxgmAxGfLmI=; b=TyHQbsYxd92JNCOdwESYkzhxd2wtqp/CXZ83CFRvupRMewwwvXhVEy8fvJcykuy50n 7wHJo5qGX23Ywc35weHJvVDFZKH6SV0R86DcsV1y+6m+/Ey6mcqBIAkTPxRFMhigmAOa tuHVKbbfzcE2yRpo9GDtuKz1eLAUAgb03QgWbk/Yvt3bbXMoz3K/zxfU5B1GBp28DSdM 4Y0/srIS0xYQ4xqdFvzSU1rcan8NJzeKfFydupdJ/4Ql+zqBOkAtf4xbFd+CyzW1GLvp BkiYrRXqNR+UbqM93oy2F2qvpcPb+aNhXRPqavOCjzQ05QMNIVJJEReLkqEvpMeVxJfh bm8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720097353; x=1720702153; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=mE9NVMNgeMpdIBYLHPdIh0Aogurvyr2VaxgmAxGfLmI=; b=oLSAsL43Zri3HzIrebMkygH1DkcByaQ36xI638nidoxICfzNZq0kcqIUnBavJHpHyP JPk48SIStZZU6C+9cB1uOnOM2xD1/Yj2ybbCuzvPX7WH0AJ2E2Rf3+VGo9Yzjaqkl5VJ XcSj4Gx+JEGki3D+m8gAvCcNWf7C2vRSCCcJPLLgs+VkR5AOLmcdzbl4GMDGethmCATo NxATSlW6c9tG3DnXVI6ih+IV3F52TzqyQkJdCshpG6g0ilX4cf1yOTbLsEA7zonLZGez zInwP/lh+veoqnuRVHuI9t4422Sso2lYzolmVXxIOYkAS2N6bLJ1Pv0SO3Dk7JPakVix xLbg== X-Gm-Message-State: AOJu0YzDfhMvC9JuYKTldHjK/TKOqwtmVR/8ajMfNIYLHW2NqBREWydD PnUJYBnVReuPPWVuy+3ew5eCdk7VwlmRhzzlbmbIq2JeN6X3o3Sm6qOz7v0MBZQ= X-Received: by 2002:a05:6402:5110:b0:57c:c171:2fb6 with SMTP id 4fb4d7f45d1cf-58e7a74d33dmr1041672a12.1.1720097352521; Thu, 04 Jul 2024 05:49:12 -0700 (PDT) Received: from draig.lan ([85.9.250.243]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5861381868csm8327192a12.55.2024.07.04.05.49.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jul 2024 05:49:11 -0700 (PDT) Received: from draig.lan (localhost [IPv6:::1]) by draig.lan (Postfix) with ESMTP id A9FE05F839; Thu, 4 Jul 2024 13:49:10 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , Paul Burton , Aleksandar Rikalo Subject: [RFC PATCH] hw/core: ensure kernel_end never gets used undefined Date: Thu, 4 Jul 2024 13:49:04 +0100 Message-Id: <20240704124904.276603-1-alex.bennee@linaro.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::529; envelope-from=alex.bennee@linaro.org; helo=mail-ed1-x529.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Really the problem here is the return values of fit_load_[kernel|fdt]() are a little all over the place. However we don't want to somehow get through not having set kernel_end and having it just be random unused data. The compiler complained on an --enable-gcov build: In file included from ../../hw/core/loader-fit.c:20: /home/alex/lsrc/qemu.git/include/qemu/osdep.h: In function ‘load_fit’: /home/alex/lsrc/qemu.git/include/qemu/osdep.h:486:45: error: ‘kernel_end’ may be used uninitialized [-Werror=maybe-uninitialized] 486 | #define ROUND_UP(n, d) ROUND_DOWN((n) + (d) - 1, (d)) | ^ ../../hw/core/loader-fit.c:270:12: note: ‘kernel_end’ was declared here 270 | hwaddr kernel_end; | ^~~~~~~~~~ Signed-off-by: Alex Bennée Reviewed-by: Aleksandar Rikalo --- hw/core/loader-fit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/core/loader-fit.c b/hw/core/loader-fit.c index 9f20007dbb..7ccc9d5fbc 100644 --- a/hw/core/loader-fit.c +++ b/hw/core/loader-fit.c @@ -267,7 +267,7 @@ int load_fit(const struct fit_loader *ldr, const char *filename, void *opaque) const char *def_cfg_name; char path[FIT_LOADER_MAX_PATH]; int itb_size, configs, cfg_off, off; - hwaddr kernel_end; + hwaddr kernel_end = 0; int ret; itb = load_device_tree(filename, &itb_size);