On Sun, 28 Aug 2022 20:12:41 -0500 Rob Herring <robh+dt@xxxxxxxxxx> wrote: > > Shouldn't we just check that start < end? > > Can we check this somewhere not DT specific (and also not arch > specific)? Then we don't have to worry if any other method of setting > initrd could have the same error. Yes, we can switch from checking on the end being 0 to that proposed: - if (!end) - return; + if (start >= end) + return; Then the check would even go further as would also catch cases where end < start. My taking is early_init_dt_scan_chosen() that sets initrd size incorrectly is DT specific but generic/arch agnostic. So that if the error got introduced by a bootloader/U-Boot through the DT chosen node, we should catch it in DT and react. ARM64, for example, before going down for mapping for the incorrect address (some extra large address resulting from the negative to positive value conversion), has a check after DT parsing if phys_initrd_size is other than 0 to proceed, and it is so that it passes or in other words it doesn't catch the error. Marek