Re: [PATCH v2] x86/mm/pat: (un)track_pfn_copy() fix + doc improvements

From: Ingo Molnar
Date: Wed Apr 09 2025 - 06:33:05 EST



* David Hildenbrand <david@xxxxxxxxxx> wrote:

> We got a late smatch warning and some additional review feedback.
>
> smatch warnings:
> mm/memory.c:1428 copy_page_range() error: uninitialized symbol 'pfn'.
>
> We actually use the pfn only when it is properly initialized; however,
> we may pass an uninitialized value to a function -- although it will not
> use it that likely still is UB in C.
>
> So let's just fix it by always initializing pfn in the caller of
> track_pfn_copy(), and improving the documentation of track_pfn_copy().
>
> While at it, clarify the doc of untrack_pfn_copy(), that internal checks
> make sure if we actually have to untrack anything.

Note that the title isn't accurate anymore, it's not an 'x86/mm/pat'
patch, but an 'mm' patch.

Thanks,

Ingo