mm/memory-failure: cast index to loff_t before shifting it
authorMatthew Wilcox (Oracle) <willy@infradead.org>
Mon, 18 Dec 2023 13:58:37 +0000 (13:58 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Jan 2024 14:19:43 +0000 (15:19 +0100)
commit8c7da70d9ae4c1abdf62d91d0aa28feee85c7f1b
tree2dbdc1b2665982d710067d7fcbedc2183ad82527
parent07550b1461d4d0499165e7d6f7718cfd0e440427
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>
mm/memory-failure.c