RTEMS | riscv: fix FDT length check and FDT pointer type (!1227)
Mohamed Ayman (@mohamedayman23)
gitlab at rtems.org
Sun May 3 02:54:14 UTC 2026
Mohamed Ayman commented on a discussion: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1227#note_149422
Ok, the previous check was iincorrect because fdt_getprop() returns the length in bytes, while the code compared it with the number of address cells. This could allow truncated properties to pass the check and lead to invalid memory access.
I fixed it by checcking against ac \* sizeof(uint32_t), which matches the actual data size.
I tested this change by running the RTEMS hello world on QEMU (qemu-system-riscv64 -M virt with #address-cells = \<2\>), and it worked **without any regression Nothing Breaks**.
{width=900 height=365}
--
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/1227#note_149422
You're receiving this email because of your account on gitlab.rtems.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20260503/def547b0/attachment-0001.htm>
More information about the bugs
mailing list