The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Zijun Hu <zijun_hu@icloud.com>
To: Rob Herring <robh@kernel.org>,
	Saravana Kannan <saravanak@google.com>,
	 Oreoluwa Babatunde <quic_obabatun@quicinc.com>
Cc: Zijun Hu <zijun_hu@icloud.com>,
	devicetree@vger.kernel.org,  linux-kernel@vger.kernel.org,
	Zijun Hu <quic_zijuhu@quicinc.com>,
	 stable@vger.kernel.org
Subject: [PATCH v5 2/3] of: reserved-memory: Warn for missing static reserved memory regions
Date: Tue, 14 Jan 2025 23:23:04 +0800	[thread overview]
Message-ID: <20250114-of_core_fix-v5-2-b8bafd00a86f@quicinc.com> (raw)
In-Reply-To: <20250114-of_core_fix-v5-0-b8bafd00a86f@quicinc.com>

From: Zijun Hu <quic_zijuhu@quicinc.com>

For child node of /reserved-memory, its property 'reg' may contain
multiple regions, but fdt_scan_reserved_mem_reg_nodes() only takes
into account the first region, and miss remaining regions.

But there are no simple approach to fix it, so give user warning
message when miss remaining regions.

Fixes: 8a6e02d0c00e ("of: reserved_mem: Restructure how the reserved memory regions are processed")
Cc: stable@vger.kernel.org
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
---
 drivers/of/of_reserved_mem.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 17c57118c4960d8ac502add1904f7f464258f5a1..75e819f66a56139a800dba5e2e0044d0bbeb065e 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -263,6 +263,11 @@ void __init fdt_scan_reserved_mem_reg_nodes(void)
 			       uname);
 			continue;
 		}
+
+		if (len > t_len)
+			pr_warn("%s() ignores %d regions in node '%s'\n",
+				__func__, len / t_len - 1, uname);
+
 		base = dt_mem_next_cell(dt_root_addr_cells, &prop);
 		size = dt_mem_next_cell(dt_root_size_cells, &prop);
 

-- 
2.34.1


  parent reply	other threads:[~2025-01-14 15:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-14 15:23 [PATCH v5 0/3] of: fix bugs and improve codes Zijun Hu
2025-01-14 15:23 ` [PATCH v5 1/3] of: Do not expose of_alias_scan() and correct its comments Zijun Hu
2025-01-14 15:23 ` Zijun Hu [this message]
2025-01-14 15:23 ` [PATCH v5 3/3] of: Correct element count for two arrays in API of_parse_phandle_with_args_map() Zijun Hu
2025-01-17 14:53 ` [PATCH v5 0/3] of: fix bugs and improve codes Rob Herring (Arm)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250114-of_core_fix-v5-2-b8bafd00a86f@quicinc.com \
    --to=zijun_hu@icloud.com \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_obabatun@quicinc.com \
    --cc=quic_zijuhu@quicinc.com \
    --cc=robh@kernel.org \
    --cc=saravanak@google.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox