On Thu, Sep 5, 2024 at 8:41 AM Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx> wrote: > > On Thu, Sep 05, 2024 at 08:15:40AM GMT, Rob Herring wrote: > > On Thu, Sep 5, 2024 at 2:46 AM Thomas Weißschuh > > <thomas.weissschuh@xxxxxxxxxxxxx> wrote: > > > > > > 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". > > > > A nice follow-up would be to make of_pci_range_to_resource() use > > overflows_type() as well instead of open coding it. > > Good catch. > > There are some differences though, it > * returns -EINVAL on overflow instead of -EOVERFLOW I think that is safe to change. I don't see any cases looking at the specific errno. Note that of_range_to_resource() kerneldoc would need updating too. > * sets ->start and ->end to OF_BAD_ADDR on overflow Don't need to do that. No user accesses the resource on error. > * does not check ->end for overflow Obviously we want to do that. Rob