mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-02-22 21:36:13 +00:00
mm: fix build warning for uninitialized value
do_wp_page() sets mmun_called if mmun_start and mmun_end were initialized and, if so, may call mmu_notifier_invalidate_range_end() with these values. This doesn't prevent gcc from emitting a build warning though: mm/memory.c: In function `do_wp_page': mm/memory.c:2530: warning: `mmun_start' may be used uninitialized in this function mm/memory.c:2531: warning: `mmun_end' may be used uninitialized in this function It's much easier to initialize the variables to impossible values and do a simple comparison to determine if they were initialized to remove the bool entirely. Signed-off-by: David Rientjes <rientjes@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
63c3b902e5
commit
1756954c61
10
mm/memory.c
10
mm/memory.c
@ -2527,9 +2527,8 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
int page_mkwrite = 0;
|
int page_mkwrite = 0;
|
||||||
struct page *dirty_page = NULL;
|
struct page *dirty_page = NULL;
|
||||||
unsigned long mmun_start; /* For mmu_notifiers */
|
unsigned long mmun_start = 0; /* For mmu_notifiers */
|
||||||
unsigned long mmun_end; /* For mmu_notifiers */
|
unsigned long mmun_end = 0; /* For mmu_notifiers */
|
||||||
bool mmun_called = false; /* For mmu_notifiers */
|
|
||||||
|
|
||||||
old_page = vm_normal_page(vma, address, orig_pte);
|
old_page = vm_normal_page(vma, address, orig_pte);
|
||||||
if (!old_page) {
|
if (!old_page) {
|
||||||
@ -2708,8 +2707,7 @@ gotten:
|
|||||||
goto oom_free_new;
|
goto oom_free_new;
|
||||||
|
|
||||||
mmun_start = address & PAGE_MASK;
|
mmun_start = address & PAGE_MASK;
|
||||||
mmun_end = (address & PAGE_MASK) + PAGE_SIZE;
|
mmun_end = mmun_start + PAGE_SIZE;
|
||||||
mmun_called = true;
|
|
||||||
mmu_notifier_invalidate_range_start(mm, mmun_start, mmun_end);
|
mmu_notifier_invalidate_range_start(mm, mmun_start, mmun_end);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2778,7 +2776,7 @@ gotten:
|
|||||||
page_cache_release(new_page);
|
page_cache_release(new_page);
|
||||||
unlock:
|
unlock:
|
||||||
pte_unmap_unlock(page_table, ptl);
|
pte_unmap_unlock(page_table, ptl);
|
||||||
if (mmun_called)
|
if (mmun_end > mmun_start)
|
||||||
mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
|
mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
|
||||||
if (old_page) {
|
if (old_page) {
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user