[PATCH] of: print warning when cmdline overflows from bootargs
From: Enlin Mu
Date: Wed Nov 05 2025 - 03:27:40 EST
From: Enlin Mu <enlin.mu@xxxxxxxxx>
add debug info. sometimes cmdline in dts is too long,
developers are not aware of the length limit of the
cmdline, resulting in some misjudgments.
Signed-off-by: Enlin Mu <enlin.mu@xxxxxxxxx>
---
drivers/of/fdt.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 0edd639898a6..077799b2f565 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -1085,6 +1085,8 @@ int __init early_init_dt_scan_chosen(char *cmdline)
p = of_get_flat_dt_prop(node, "bootargs", &l);
if (p != NULL && l > 0)
strscpy(cmdline, p, min(l, COMMAND_LINE_SIZE));
+ if (l > COMMAND_LINE_SIZE)
+ pr_warn("cmdline overflows from bootargs\n");
handle_cmdline:
/*
--
2.39.5