[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z_K5uW2eu7GInRxs@gmail.com>
Date: Sun, 6 Apr 2025 19:28:25 +0200
From: Ingo Molnar <mingo@...nel.org>
To: David Hildenbrand <david@...hat.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org, x86@...nel.org,
kernel test robot <lkp@...el.com>,
Dan Carpenter <error27@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Andy Lutomirski <luto@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Rik van Riel <riel@...riel.com>, "H. Peter Anvin" <hpa@...or.com>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH v1] x86/mm/pat: (un)track_pfn_copy() fix + improvements
* David Hildenbrand <david@...hat.com> 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'.
> - if (!(src_vma->vm_flags & VM_PAT))
> + if (!(src_vma->vm_flags & VM_PAT)) {
> + *pfn = 0;
> return 0;
> + }
> static inline int track_pfn_copy(struct vm_area_struct *dst_vma,
> struct vm_area_struct *src_vma, unsigned long *pfn)
> {
> + *pfn = 0;
> return 0;
> }
That's way too ugly. There's nothing wrong with not touching 'pfn' in
the error path: in fact it's pretty standard API where output pointers
may not get set on errors.
If Smatch has a problem with it, Smatch should be fixed, or the false
positive warning should be worked around by initializing 'pfn' in the
callers.
Thanks,
Ingo
Powered by blists - more mailing lists