lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240701215441.54353-1-heinrich.schuchardt@canonical.com>
Date: Mon,  1 Jul 2024 23:54:41 +0200
From: Heinrich Schuchardt <heinrich.schuchardt@...onical.com>
To: Rob Herring <robh@...nel.org>,
	Saravana Kannan <saravanak@...gle.com>
Cc: devicetree@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Heinrich Schuchardt <heinrich.schuchardt@...onical.com>
Subject: [PATCH 1/1] libfdt: check return value of fdt_num_mem_rsv() in fdt_pack()

fdt_num_mem_rsv() may return -FDT_ERR_TRUNCATED.
In this case fdt_pack() should propagate the error code.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@...onical.com>
---
 libfdt/fdt_rw.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/libfdt/fdt_rw.c b/libfdt/fdt_rw.c
index 3621d36..a307701 100644
--- a/libfdt/fdt_rw.c
+++ b/libfdt/fdt_rw.c
@@ -490,8 +490,11 @@ int fdt_pack(void *fdt)
 
 	FDT_RW_PROBE(fdt);
 
-	mem_rsv_size = (fdt_num_mem_rsv(fdt)+1)
-		* sizeof(struct fdt_reserve_entry);
+	mem_rsv_size = fdt_num_mem_rsv(fdt);
+	if (mem_rsv_size < 0)
+		return mem_rsv_size;
+
+	mem_rsv_size = (mem_rsv_size + 1) * sizeof(struct fdt_reserve_entry);
 	fdt_packblocks_(fdt, fdt, mem_rsv_size, fdt_size_dt_struct(fdt),
 			fdt_size_dt_strings(fdt));
 	fdt_set_totalsize(fdt, fdt_data_size_(fdt));
-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ