lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250305172800.3465120-1-arnd@kernel.org>
Date: Wed,  5 Mar 2025 18:27:56 +0100
From: Arnd Bergmann <arnd@...nel.org>
To: Andrew Morton <akpm@...ux-foundation.org>,
	"Liam R. Howlett" <Liam.Howlett@...cle.com>,
	Lorenzo Stoakes <lorenzo.stoakes@...cle.com>
Cc: Arnd Bergmann <arnd@...db.de>,
	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: [PATCH] mm/mremap: fix uninitialized return code

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>
---
 mm/mremap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/mm/mremap.c b/mm/mremap.c
index 456849b9e7bd..9c51a2360d84 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -1014,6 +1014,7 @@ static unsigned long prep_move_vma(struct vma_remap_struct *vrm)
 		return -ENOMEM;
 
 	if (vma->vm_ops && vma->vm_ops->may_split) {
+		err = 0;
 		if (vma->vm_start != old_addr)
 			err = vma->vm_ops->may_split(vma, old_addr);
 		if (!err && vma->vm_end != old_addr + old_len)
-- 
2.39.5


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ