All of lore.kernel.org
 help / color / mirror / Atom feed
* re: mm: remove rest usage of VM_NONLINEAR and pte_file()
@ 2015-01-22 13:28 Dan Carpenter
  2015-01-22 15:18 ` Kirill A. Shutemov
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-01-22 13:28 UTC (permalink / raw)
  To: kirill.shutemov; +Cc: linux-mm

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>

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

* Re: mm: remove rest usage of VM_NONLINEAR and pte_file()
  2015-01-22 13:28 mm: remove rest usage of VM_NONLINEAR and pte_file() Dan Carpenter
@ 2015-01-22 15:18 ` Kirill A. Shutemov
  0 siblings, 0 replies; 2+ messages in thread
From: Kirill A. Shutemov @ 2015-01-22 15:18 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: kirill.shutemov, linux-mm

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.

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

end of thread, other threads:[~2015-01-22 15:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-22 13:28 mm: remove rest usage of VM_NONLINEAR and pte_file() Dan Carpenter
2015-01-22 15:18 ` Kirill A. Shutemov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.