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 62865C0015E for ; Thu, 27 Jul 2023 03:02:44 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id BA2E786823; Thu, 27 Jul 2023 05:02:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org 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=chromium.org header.i=@chromium.org header.b="KXzXxsBD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AD0F3857BF; Thu, 27 Jul 2023 05:01:49 +0200 (CEST) Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) (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 985D786784 for ; Thu, 27 Jul 2023 05:01:46 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x131.google.com with SMTP id e9e14a558f8ab-3460815fde5so1534135ab.2 for ; Wed, 26 Jul 2023 20:01:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1690426905; x=1691031705; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T5TYUH/F0YFbu+VzHWVATj/WBdVpiU6NPlFSSrGQtLg=; b=KXzXxsBDKypk4Pv6ysh9JSF/Fx5dA4CGah49tFcRevZQi8LRXEoLc225385FxsNI75 9E2i+LJp1/4yr9IGodujGvJGAUEzGT1oLGzENvqHP6vsSsvoGoWSaQezJc77ymp+da3e TOdC1qsATnp/8aaV5iIeQvwrhFUT93Yeb49rQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690426905; x=1691031705; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T5TYUH/F0YFbu+VzHWVATj/WBdVpiU6NPlFSSrGQtLg=; b=SlM0PLck26AJGu0i+7Zmby0n+s9UUPP7kmvV/tiUxahaEvaLY3SFBgpgQaDOsgbc/S 2aPwtQ/FxOn9yobUgf2hWKUajas+rz4psG4mD6HNtjbvVJ2nqaGEBbX4Zsg3La+flKk6 eBnBW6QizVF/UVpaFQyFXCWOBigNj5YtW1dEPynmnx3f/9N2SFdi4pK1YsNmMWfqj+sG jOijhJ/Cowww1/V4fGj5DggYWOR1Zf3PBMV9iKfEo8C3B6FITEXDaw/jXOjxw3zS7yov kRv83va2m7rfJkZEgpSU3S6gluX6ihHRE9pBzD8d2tt7tQmWMLxtejpfgMXNmDrXhqos vaIA== X-Gm-Message-State: ABy/qLasTM9/Z3YjVwDGDoAtsJlPeOvo0c3AJxy2wK69JA5Mjb7mZJfe yyGZNUZk5cbuqAzVJvjt7YF3KC6MzjG0GjnyGkU= X-Google-Smtp-Source: APBJJlHSlQQViq7jetBPkRN73d/080Se2VYvTi1uwSQZyLDngpcxyuxwy1P8NWpOaYpPxcm+NPWgDQ== X-Received: by 2002:a05:6e02:cac:b0:345:af82:dc3a with SMTP id 12-20020a056e020cac00b00345af82dc3amr3598003ilg.14.1690426905051; Wed, 26 Jul 2023 20:01:45 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id a14-20020a92d58e000000b00348d41ffd13sm207539iln.85.2023.07.26.20.01.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jul 2023 20:01:44 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH 5/5] bootstd: Init the size before reading extlinux file Date: Wed, 26 Jul 2023 21:01:25 -0600 Message-ID: <20230727030128.459760-6-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog In-Reply-To: <20230727030128.459760-1-sjg@chromium.org> References: <20230727030128.459760-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 The implementation in extlinux_pxe_getfile() does not pass a valid size to bootmeth_read_file(), so this can fail if the uninited value happens to be too small. Fix this. Signed-off-by: Simon Glass --- boot/bootmeth_pxe.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/boot/bootmeth_pxe.c b/boot/bootmeth_pxe.c index ce986bd260d1..8d489a11aa40 100644 --- a/boot/bootmeth_pxe.c +++ b/boot/bootmeth_pxe.c @@ -31,6 +31,9 @@ static int extlinux_pxe_getfile(struct pxe_context *ctx, const char *file_path, int ret; addr = simple_strtoul(file_addr, NULL, 16); + + /* Allow up to 1GB */ + *sizep = 1 << 30; ret = bootmeth_read_file(info->dev, info->bflow, file_path, addr, sizep); if (ret) -- 2.41.0.487.g6d72f3e995-goog