[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <eda53542-14f2-44fe-aa18-8cd3dfe1ed75@app.fastmail.com>
Date: Wed, 05 Mar 2025 19:25:38 +0100
From: "Arnd Bergmann" <arnd@...db.de>
To: "Lorenzo Stoakes" <lorenzo.stoakes@...cle.com>,
"Arnd Bergmann" <arnd@...nel.org>
Cc: "Andrew Morton" <akpm@...ux-foundation.org>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>,
"Vlastimil Babka" <vbabka@...e.cz>, "Jann Horn" <jannh@...gle.com>,
"Pedro Falcato" <pedro.falcato@...il.com>,
"David Hildenbrand" <david@...hat.com>,
"Kefeng Wang" <wangkefeng.wang@...wei.com>, "Jeff Xu" <jeffxu@...omium.org>,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mm/mremap: fix uninitialized return code
On Wed, Mar 5, 2025, at 18:29, Lorenzo Stoakes wrote:
> On Wed, Mar 05, 2025 at 06:27:56PM +0100, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@...db.de>
>>
>> The 'err' variable is set in a conditinal branch and is not
>> set otherwise:
>>
>> mm/mremap.c:1017:7: error: variable 'err' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
>> 1017 | if (vma->vm_start != old_addr)
>>
>> Set it to zero before the initial value is set.
>>
>> Fixes: 3129f7896afb ("mm/mremap: initial refactor of move_vma()")
>> Signed-off-by: Arnd Bergmann <arnd@...db.de>
>
> Thanks for this, however this has already been fixed via Andrew doing a
> fix-patch which should land in mm-unstable,-next soon (possibly tmr?).
>
> This is entirely my bad btw, for some reason my compiler locally didn't
> catch this even with CONFIG_WERROR on which _really_ surprises me...
Unfortunately gcc never shows warnings about conditionally uninitialized
variables. There is a -Wmaybe-uninitialized, but that has so many
false positives that it is completely useless and it is turned
off globally.
Arnd
Powered by blists - more mailing lists