Julius Werner has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35377 )
Change subject: lib/fmap: Cache FMAP in cbmem ......................................................................
Patch Set 10: Code-Review+2
(1 comment)
https://review.coreboot.org/c/coreboot/+/35377/10/src/lib/fmap.c File src/lib/fmap.c:
https://review.coreboot.org/c/coreboot/+/35377/10/src/lib/fmap.c@46 PS10, Line 46: if (region_device_sz(&cache->rdev))
this accesses cache->rdev (and inside, several more level of indirection) without checking if any of […]
That should be fine? There should be no way to dereference a NULL pointer if that's what you're worried about, the result of car_get_var_ptr() should always be valid and the struct region that contains the size field is directly embedded in struct mem_region_device. I know it's a bit of pointer soup to unwrap all these APIs, but in the end it should only reference stuff that's part of the global variable itself.