Hi Daniel, On Mon, Dec 29, 2025 at 10:42:54AM +0900, Daniel Palmer wrote: > Hi Kuan-Wei, > > On Mon, 29 Dec 2025 at 04:13, Kuan-Wei Chiu <[email protected]> wrote: > > > > > > One thing I found when I did the bootinfo parsing in my version is if > > > I corrupted (during relocation etc) the bootinfo this type of loop > > > would often get stuck forever. > > > I'm not sure what the technical limit of the number of bootinfo > > > entries is but bounding this to something reasonable feels like a good > > > idea. > > > > In that scenario, I assume the correct error handling would be to add a > > loop limit and trigger a panic() if exceeded? > > Yeah I think so, if you didn't find the last bootinfo entry within > some reasonable bounds everything is probably broken and you shouldn't > continue. > I think for most real machines (Amiga etc) there aren't many entries > but for the virt machine maybe there is an entry per virtio mmio > device so there might actually be a lot of them there.
So the problem becomes determining a reasonable limit. I think we can safely assume the bootinfo buffer won't exceed a 4KB page size. Since the minimum record size is 4 bytes (tag + size), setting the maximum records to 4096 / 4 =1024 should be a safe assumption? Regards, Kuan-Wei

