aboutsummaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle)2023-12-18 13:58:37 +0000
committerGreg Kroah-Hartman2024-01-05 15:18:39 +0100
commitfb21c9780a316953a61af6657b55f745722783bb (patch)
tree4fe23f20a2818199150a5ecfc77a9f5687c56ae3 /mm
parentbe72d197b2281e2ee3f28017fc9be1ab17e26d16 (diff)
mm/memory-failure: cast index to loff_t before shifting it
commit 39ebd6dce62d8cfe3864e16148927a139f11bc9a upstream. On 32-bit systems, we'll lose the top bits of index because arithmetic will be performed in unsigned long instead of unsigned long long. This affects files over 4GB in size. Link: https://lkml.kernel.org/r/20231218135837.3310403-4-willy@infradead.org Fixes: 6100e34b2526 ("mm, memory_failure: Teach memory_failure() about dev_pagemap pages") Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/memory-failure.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 99de0328d1be..c45b8c64cdcd 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1560,7 +1560,7 @@ static void unmap_and_kill(struct list_head *to_kill, unsigned long pfn,
* mapping being torn down is communicated in siginfo, see
* kill_proc()
*/
- loff_t start = (index << PAGE_SHIFT) & ~(size - 1);
+ loff_t start = ((loff_t)index << PAGE_SHIFT) & ~(size - 1);
unmap_mapping_range(mapping, start, size, 0);
}