linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [bug report] mm/mremap: complete refactor of move_vma()
@ 2025-06-25 15:22 Dan Carpenter
  2025-06-25 15:28 ` Lorenzo Stoakes
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2025-06-25 15:22 UTC (permalink / raw)
  To: lorenzo.stoakes; +Cc: linux-mm

Hello Lorenzo Stoakes,

The patch b714ccb02a76: "mm/mremap: complete refactor of move_vma()"
from Mar 10, 2025, leads to the following static checker warning:

	mm/mremap.c:1920 move_vma()
	error: uninitialized symbol 'new_vma'.

mm/mremap.c
    1895 static unsigned long move_vma(struct vma_remap_struct *vrm)
    1896 {
    1897 	struct mm_struct *mm = current->mm;
    1898 	struct vm_area_struct *new_vma;
    1899 	unsigned long hiwater_vm;
    1900 	int err;
    1901 
    1902 	err = prep_move_vma(vrm);
    1903 	if (err)
    1904 		return err;
    1905 
    1906 	/* If accounted, charge the number of bytes the operation will use. */
    1907 	if (!vrm_charge(vrm))
    1908 		return -ENOMEM;
    1909 
    1910 	/* We don't want racing faults. */
    1911 	vma_start_write(vrm->vma);
    1912 
    1913 	/* Perform copy step. */
    1914 	err = copy_vma_and_data(vrm, &new_vma);
    1915 	/*
    1916 	 * If we established the copied-to VMA, we attempt to recover from the
    1917 	 * error by setting the destination VMA to the source VMA and unmapping
    1918 	 * it below.
    1919 	 */
--> 1920 	if (err && !new_vma)
                            ^^^^^^^
new_vma isn't set on the first error path in copy_vma_and_data().

    1921 		return err;
    1922 
    1923 	/*
    1924 	 * If we failed to move page tables we still do total_vm increment
    1925 	 * since do_munmap() will decrement it by old_len == new_len.
    1926 	 *
    1927 	 * Since total_vm is about to be raised artificially high for a

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-06-25 15:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-25 15:22 [bug report] mm/mremap: complete refactor of move_vma() Dan Carpenter
2025-06-25 15:28 ` Lorenzo Stoakes
2025-06-25 15:35   ` Dan Carpenter
2025-06-25 15:41     ` Lorenzo Stoakes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox