]> www.infradead.org Git - users/jedix/linux-maple.git/commit
of: address: Unify resource bounds overflow checking
authorThomas Weißschuh <thomas.weissschuh@linutronix.de>
Fri, 6 Sep 2024 12:25:19 +0000 (14:25 +0200)
committerRob Herring (Arm) <robh@kernel.org>
Fri, 13 Sep 2024 19:00:52 +0000 (14:00 -0500)
commit1a52a094c2f0821860d9ce15fffe01103a146f1f
tree4403d7cd86e6b2c80bc31159cc29816f1fabe291
parent22e2bf1214ff50981c7e056970241a36ab1f3d14
of: address: Unify resource bounds overflow checking

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.

Refactor the diff overflow checks into a helper function.
Also extend the checks to validate each calculation step.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Link: https://lore.kernel.org/r/20240906-of-address-overflow-v1-1-19567aaa61da@linutronix.de
[robh: Fix to not return error on 0 sized resource]
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
drivers/of/address.c