On 5/30/2022 7:59 PM, Gerd Hoffmann wrote:
Hi,
tdx_add_ram_entry() increments tdx_guest->nr_ram_entries. I think it's worth
for comments why this is safe regarding to this for-loop.
The for-loop is to find the valid existing RAM entry (from E820 table).
It will update the RAM entry and increment tdx_guest->nr_ram_entries when
the initial RAM entry needs to be split. However, once find, the for-loop is
certainly stopped since it returns unconditionally.
Add a comment saying so would be good.
Or move the code block doing the update out of the loop. That will
likewise make clear that finding the entry which must be updated is
the only purpose of the loop.
Good idea. I'll go this way.
take care,
Gerd