Skip to contentSkip to conversation

FAILED: patch "[PATCH] mm/memory-failure: cast index to loff_t before shifting it" failed to apply to 4.19-stable tree

PATCH [email protected] 1 participant 1 message Jan 2, 2024

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.19.y
git checkout FETCH_HEAD
git cherry-pick -x 39ebd6dce62d8cfe3864e16148927a139f11bc9a
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2024010257-patchy-barge-f278@gregkh' --subject-prefix 'PATCH 4.19.y' HEAD^..

Possible dependencies:

39ebd6dce62d ("mm/memory-failure: cast index to loff_t before shifting it") 00cc790e0036 ("mm: factor helpers for memory_failure_dev_pagemap")
f25cbb7a95a2 ("mm: add zone device coherent type memory support")
034e5afad921 ("mm: re-allow pinning of zero pfns")
1c563432588d ("mm: fix is_pinnable_page against a cma page")
405ce051236c ("mm/hwpoison: fix race between hugetlb free/demotion and memory_failure_hugetlb()") 9030fb0bb9d6 ("Merge tag 'folio-5.18c' of git://git.infradead.org/users/willy/pagecache")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 39ebd6dce62d8cfe3864e16148927a139f11bc9a Mon Sep 17 00:00:00 2001
From: "Matthew Wilcox (Oracle)" <[email protected]>
Date: Mon, 18 Dec 2023 13:58:37 +0000
Subject: [PATCH] mm/memory-failure: cast index to loff_t before shifting it

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.

Fixes 6100e34b2526 ("mm, memory_failure: Teach memory_failure() about dev_pagemap pages")
Cc Dan Williams <[email protected]>
Cc Naoya Horiguchi <[email protected]>
mm/memory-failure.c +1 -1
index 82e15baabb48..455093f73a70 100644
@@ -1704,7 +1704,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);
 	}