]> git.itanic.dy.fi Git - linux-stable/commitdiff
parisc: Fix encoding of swp_entry due to added SWP_EXCLUSIVE flag
authorHelge Deller <deller@gmx.de>
Sat, 13 May 2023 20:30:06 +0000 (22:30 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 12:02:05 +0000 (14:02 +0200)
commit 6f9e98849edaa8aefc4030ff3500e41556e83ff7 upstream.

Fix the __swp_offset() and __swp_entry() macros due to commit 6d239fc78c0b
("parisc/mm: support __HAVE_ARCH_PTE_SWP_EXCLUSIVE") which introduced the
SWP_EXCLUSIVE flag by reusing the _PAGE_ACCESSED flag.

Reported-by: Christoph Biedl <linux-kernel.bfrz@manchmal.in-ulm.de>
Tested-by: Christoph Biedl <linux-kernel.bfrz@manchmal.in-ulm.de>
Reviewed-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Fixes: 6d239fc78c0b ("parisc/mm: support __HAVE_ARCH_PTE_SWP_EXCLUSIVE")
Cc: <stable@vger.kernel.org> # v6.3+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/parisc/include/asm/pgtable.h

index e2950f5db7c9cf621f1409dc532d2c86591df759..e715df5385d6e5c415decd20f89d8c47f8ee5567 100644 (file)
@@ -413,12 +413,12 @@ extern void paging_init (void);
  *   For the 64bit version, the offset is extended by 32bit.
  */
 #define __swp_type(x)                     ((x).val & 0x1f)
-#define __swp_offset(x)                   ( (((x).val >> 6) &  0x7) | \
-                                         (((x).val >> 8) & ~0x7) )
+#define __swp_offset(x)                   ( (((x).val >> 5) & 0x7) | \
+                                         (((x).val >> 10) << 3) )
 #define __swp_entry(type, offset)         ((swp_entry_t) { \
                                            ((type) & 0x1f) | \
-                                           ((offset &  0x7) << 6) | \
-                                           ((offset & ~0x7) << 8) })
+                                           ((offset & 0x7) << 5) | \
+                                           ((offset >> 3) << 10) })
 #define __pte_to_swp_entry(pte)                ((swp_entry_t) { pte_val(pte) })
 #define __swp_entry_to_pte(x)          ((pte_t) { (x).val })