Skip to content

Commit

Permalink
um: Fix __swp_type()
Browse files Browse the repository at this point in the history
The current __swp_type() function uses a too small bitshift.
Using more than one swap files causes bad pages because
the type bits clash with other page flags.

CC: stable@kernel.org
Analyzed-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
  • Loading branch information
Richard Weinberger committed May 21, 2012
1 parent f15b900 commit 2b76eba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/um/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,11 @@ extern pte_t *virt_to_pte(struct mm_struct *mm, unsigned long addr);
#define update_mmu_cache(vma,address,ptep) do ; while (0)

/* Encode and de-code a swap entry */
#define __swp_type(x) (((x).val >> 4) & 0x3f)
#define __swp_type(x) (((x).val >> 5) & 0x1f)
#define __swp_offset(x) ((x).val >> 11)

#define __swp_entry(type, offset) \
((swp_entry_t) { ((type) << 4) | ((offset) << 11) })
((swp_entry_t) { ((type) << 5) | ((offset) << 11) })
#define __pte_to_swp_entry(pte) \
((swp_entry_t) { pte_val(pte_mkuptodate(pte)) })
#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
Expand Down

0 comments on commit 2b76eba

Please sign in to comment.