mm/ksm: return NULL when doesn't get mergeable page
PATCH 1/1 mm/ksm: return NULL when doesn't get mergeable page
In get_mergeable_page() local variable page is not initialized, it may hold a garbage value, when find_mergeable_vma() return NULL, get_mergeable_page() may return a garbage value to the caller.
So initialize page as NULL.
--- mm/ksm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
mm/ksm.c +1 -1
@@ -460,7 +460,7 @@ static struct page *get_mergeable_page(struct rmap_item *rmap_item)struct mm_struct *mm = rmap_item->mm;unsigned long addr = rmap_item->address;struct vm_area_struct *vma; -struct page *page; +struct page *page =NULL ;down_read (&mm->mmap_sem); vma =find_mergeable_vma (mm, addr);
Signature · 8 lines
1.7.1 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 27 lines · Jianguo Wu
In
get_mergeable_page()local variable page is not initialized, it may hold a garbage value, whenfind_mergeable_vma()return NULL,get_mergeable_page()may return a garbage value to the caller.So initialize page as NULL.
Signed-off-by Jianguo Wu <[email protected]>--- mm/ksm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)mm/ksm.c +1
-1@@ -460,7 +460,7 @@ static struct page *get_mergeable_page(struct rmap_item *rmap_item)struct mm_struct *mm = rmap_item->mm;unsigned long addr = rmap_item->address;struct vm_area_struct *vma; -struct page *page; +struct page *page =NULL ;down_read (&mm->mmap_sem); vma =find_mergeable_vma (mm, addr);Signature · 1 line
1.7.1
When find_mergeable_vma returned NULL, NULL is assigned to page in "out" statement.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 23 lines · Petr Holasek
Quoted 22 lines · Jianguo Wu
In
get_mergeable_page()local variable page is not initialized, it may hold a garbage value, whenfind_mergeable_vma()return NULL,get_mergeable_page()may return a garbage value to the caller.So initialize page as NULL.
Signed-off-by Jianguo Wu <[email protected]>--- mm/ksm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)mm/ksm.c +1
-1@@ -460,7 +460,7 @@ static struct page *get_mergeable_page(struct rmap_item *rmap_item)struct mm_struct *mm = rmap_item->mm;unsigned long addr = rmap_item->address;struct vm_area_struct *vma; -struct page *page; +struct page *page =NULL ;
Quoted 9 lines
Quoted 5 lines
mm/ksm.c +0
-0down_read (&mm->mmap_sem); vma =find_mergeable_vma (mm, addr);Signature · 1 line
1.7.1When
find_mergeable_vmareturned NULL, NULL is assigned to page in "out" statement.
Oh, yes, thanks, Petr.
Quoted 1 line
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>