]> www.infradead.org Git - users/willy/xarray.git/commit
of: address: Report error on resource bounds overflow
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>
Thu, 5 Sep 2024 07:46:01 +0000 (09:46 +0200)
committerRob Herring (Arm) <robh@kernel.org>
Thu, 5 Sep 2024 13:19:47 +0000 (08:19 -0500)
commit000f6d588a8f3d128f89351058dc04d38e54a327
tree36bcc02fe8d3b0b20a515f8030de5c222a669774
parent05144ab7b7eaf531fc728fcb79dcf36b621ff42d
of: address: Report error on resource bounds overflow

The members "start" and "end" of struct resource are of type
"resource_size_t" which can be 32bit wide.
Values read from OF however are always 64bit wide.
Avoid silently truncating the value and instead return an error value.

This can happen on real systems when the DT was created for a
PAE-enabled kernel and a non-PAE kernel is actually running.
For example with an arm defconfig and "qemu-system-arm -M virt".

Link: https://bugs.launchpad.net/qemu/+bug/1790975
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Tested-by: Nam Cao <namcao@linutronix.de>
Reviewed-by: Nam Cao <namcao@linutronix.de>
Link: https://lore.kernel.org/r/20240905-of-resource-overflow-v1-1-0cd8bb92cc1f@linutronix.de
Cc: stable@vger.kernel.org
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
drivers/of/address.c