Re: mm: remove rest usage of VM_NONLINEAR and pte_file()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jan 22, 2015 at 04:28:13PM +0300, Dan Carpenter wrote:
> Hello Kirill A. Shutemov,
> 
> The patch 05864bbd92f9: "mm: remove rest usage of VM_NONLINEAR and
> pte_file()" from Jan 17, 2015, leads to the following static checker
> warning:
> 
> 	mm/memcontrol.c:4794 mc_handle_file_pte()
> 	warn: passing uninitialized 'pgoff'

Please test the patch below.

>From 8f5e49bd3e1199828d0233a99ed680a57ee1908f Mon Sep 17 00:00:00 2001
From: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx>
Date: Thu, 22 Jan 2015 17:13:54 +0200
Subject: [PATCH] memcg: fix static checker warning

The patch "mm: remove rest usage of VM_NONLINEAR and pte_file()" from
Jan 17, 2015, leads to the following static checker warning:

        mm/memcontrol.c:4794 mc_handle_file_pte()
        warn: passing uninitialized 'pgoff'

After the patch, the only case when mc_handle_file_pte() called is
pte_none(ptent). The 'if' check is redundant and lead to the warning.
Let's drop it.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
---
 mm/memcontrol.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index cd42f14d138a..a6140c0764f4 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -4792,8 +4792,7 @@ static struct page *mc_handle_file_pte(struct vm_area_struct *vma,
 		return NULL;
 
 	mapping = vma->vm_file->f_mapping;
-	if (pte_none(ptent))
-		pgoff = linear_page_index(vma, addr);
+	pgoff = linear_page_index(vma, addr);
 
 	/* page is moved even if it's not RSS of this task(page-faulted). */
 #ifdef CONFIG_SWAP
-- 
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]