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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240304150227.166053-1-skseofh@gmail.com>
Date: Tue,  5 Mar 2024 00:02:26 +0900
From: skseofh@...il.com
To: robh+dt@...nel.org
Cc: devicetree@...r.kernel.org,
	frowand.list@...il.com,
	linux-kernel@...r.kernel.org,
	skseofh@...il.com
Subject: [PATCH] of: fdt: modify small size memory check


>>
>> From: Daero Lee <skseofh@...il.com>
>>
>> After page aligning, the size may become zero. So I added exception
>> handling code for size 0.
>
>That may be true, but when would anyone only have memory regions of
>less than 2 pages. In any case memblock_add will just do nothing. What
>is the actual problem you are having?
>
>Rob

Ignore the previous mail.
I modified the patch to clear this size check routine. Please check

-------------------------------------------------------------------------
>From 2135d37c37f8c369033f79102b17ddf5bb3ff838 Mon Sep 17 00:00:00 2001
From: Daero Lee <skseofh@...il.com>
Date: Mon, 4 Mar 2024 23:21:14 +0900
Subject: [PATCH] of: fdt: modify small size memory check

Small size memory which is less than 1 PAGE_SIZE after page align
should not be added to memblock.

In this patch, the size check was modified to make it clear.

Signed-off-by: Daero Lee <skseofh@...il.com>
---
 drivers/of/fdt.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index bf502ba8da95..9cf844e664b0 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1220,18 +1220,16 @@ int __init early_init_dt_scan_chosen(char *cmdline)
 void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size)
 {
        const u64 phys_offset = MIN_MEMBLOCK_ADDR;
+       u64 abase = PAGE_ALIGN(base), aend = PAGE_ALIGN_DOWN(base + size);

-       if (size < PAGE_SIZE - (base & ~PAGE_MASK)) {
+       if((aend - abase) < PAGE_SIZE) {
                pr_warn("Ignoring memory block 0x%llx - 0x%llx\n",
                        base, base + size);
                return;
        }

-       if (!PAGE_ALIGNED(base)) {
-               size -= PAGE_SIZE - (base & ~PAGE_MASK);
-               base = PAGE_ALIGN(base);
-       }
-       size &= PAGE_MASK;
+       base = abase;
+       size = (aend - abase) & PAGE_MASK;

        if (base > MAX_MEMBLOCK_ADDR) {
                pr_warn("Ignoring memory block 0x%llx - 0x%llx\n",
--
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ