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 AC091ECAAD2 for ; Sat, 27 Aug 2022 12:48:38 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 744E3843F2; Sat, 27 Aug 2022 14:48:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.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; unprotected) header.d=kernel.org header.i=@kernel.org header.b="eYSvF993"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BD7938444D; Sat, 27 Aug 2022 14:48:29 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8668584220 for ; Sat, 27 Aug 2022 14:48:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 46CD960B1F; Sat, 27 Aug 2022 12:48:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C4EDC433C1; Sat, 27 Aug 2022 12:48:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1661604505; bh=i9gkjHHnNVSnF7MmSSg2o+MD1zEsjhuCyftkwUGTpG0=; h=From:To:Cc:Subject:Date:From; b=eYSvF993bBCaF447+NUFW8aIwgWbJC0rzi5UItiu4Jdt+UxhhIcQQ4M7QbBg/Nf2A 4AiuKZ6kcTburGC+9yX+wTXdJUS+8+wlznLosUm/XJNapI9DzSKheyHMIg9/VInD+b /ojItHr/2NY4+ZVjhMDLhnm5m98QGIhAGjSAaI9wwqDnksqPp3mqQyg5kXFl+f7sfC QA8qu6bB7nE9FGW7JdatKi9NAhF6C/rau+tsvqY7Hlpd+jiBQzz+mATQxI1s0OVQ+c 4S1siE5xmQrThDaKT2JbFYU0cEb+cVTzcCZHGoA0zVOH+vZqkAikz2ZsSdReFOGqWK KwOAn0J8tOIDA== Received: by pali.im (Postfix) id BCA26C7A; Sat, 27 Aug 2022 14:48:22 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Simon Glass , Tero Kristo Cc: u-boot@lists.denx.de Subject: [PATCH] bootm: Fix upper bound of FDT overlap checks Date: Sat, 27 Aug 2022 14:48:10 +0200 Message-Id: <20220827124810.11616-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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.6 at phobos.denx.de X-Virus-Status: Clean FTD blob can be put immediately after the OS image. So use strict inequality for start address check. Fixes: fbde7589ce30 ("common: bootm: add checks to verify if ramdisk / fdtimage overlaps OS image") Signed-off-by: Pali Rohár --- boot/bootm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boot/bootm.c b/boot/bootm.c index 86dbfbcfed5b..e4493f3ed5f1 100644 --- a/boot/bootm.c +++ b/boot/bootm.c @@ -305,9 +305,9 @@ int bootm_find_images(int flag, int argc, char *const argv[], ulong start, /* check if FDT overlaps OS image */ if (images.ft_addr && (((ulong)images.ft_addr >= start && - (ulong)images.ft_addr <= start + size) || + (ulong)images.ft_addr < start + size) || ((ulong)images.ft_addr + images.ft_len >= start && - (ulong)images.ft_addr + images.ft_len <= start + size))) { + (ulong)images.ft_addr + images.ft_len < start + size))) { printf("ERROR: FDT image overlaps OS image (OS=0x%lx..0x%lx)\n", start, start + size); return 1; -- 2.20.1