of_reserved_mem_device_init() prints kernel memory in dmesg

From: Paul Cercueil
Date: Sun Nov 27 2022 - 17:42:37 EST


Hi Christoph, Marek,

Here's what I get in dmesg on a 6.1-rc6 kernel:

OF: fdt: Reserved memory: reserved region for node 'video-memory@1f00000': base 0x01f00000, size 1 MiB
OF: reserved mem: initialized node video-memory@1f00000, compatible id shared-dma-pool
ingenic-drm 13050000.lcd-controller: assigned reserved memory node <garbage data...>

I would *think* it's because the name is obtained using fdt_get_name() in fdt_scan_reserved_mem(), and the pointer becomes invalid as soon as the FDT is freed (is it freed?).

Not sure how to fix that myself, I tried to kstrdup(uname) in fdt_reserved_mem_save_node(), but it gives me a NULL pointer, probably too early in the boot process?

Cheers,
-Paul