linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kirill.shutemov@linux.intel.com
Cc: linux-mm@kvack.org
Subject: re: mm: remove rest usage of VM_NONLINEAR and pte_file()
Date: Thu, 22 Jan 2015 16:28:13 +0300	[thread overview]
Message-ID: <20150122132813.GA15803@mwanda> (raw)

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'

mm/memcontrol.c
  4774  static struct page *mc_handle_file_pte(struct vm_area_struct *vma,
  4775                          unsigned long addr, pte_t ptent, swp_entry_t *entry)
  4776  {
  4777          struct page *page = NULL;
  4778          struct address_space *mapping;
  4779          pgoff_t pgoff;
  4780  
  4781          if (!vma->vm_file) /* anonymous vma */
  4782                  return NULL;
  4783          if (!(mc.flags & MOVE_FILE))
  4784                  return NULL;
  4785  
  4786          mapping = vma->vm_file->f_mapping;
  4787          if (pte_none(ptent))
  4788                  pgoff = linear_page_index(vma, addr);

We used to have an "else pgoff = pte_to_pgoff(ptent);" but now it's just
uninitialized data.

  4789  
  4790          /* page is moved even if it's not RSS of this task(page-faulted). */
  4791  #ifdef CONFIG_SWAP
  4792          /* shmem/tmpfs may report page out on swap: account for that too. */
  4793          if (shmem_mapping(mapping)) {
  4794                  page = find_get_entry(mapping, pgoff);
                                                       ^^^^^

Used here.

  4795                  if (radix_tree_exceptional_entry(page)) {
  4796                          swp_entry_t swp = radix_to_swp_entry(page);
  4797                          if (do_swap_account)
  4798                                  *entry = swp;
  4799                          page = find_get_page(swap_address_space(swp), swp.val);
  4800                  }
  4801          } else
  4802                  page = find_get_page(mapping, pgoff);
  4803  #else
  4804          page = find_get_page(mapping, pgoff);
                                              ^^^^^
And here.

  4805  #endif
  4806          return page;
  4807  }

regards,
dan carpenter

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

             reply	other threads:[~2015-01-22 13:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-22 13:28 Dan Carpenter [this message]
2015-01-22 15:18 ` mm: remove rest usage of VM_NONLINEAR and pte_file() Kirill A. Shutemov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150122132813.GA15803@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).