On Tue, May 12, 2026 at 07:35:23AM +0200, Christoph Hellwig wrote: > Don't blindly pass the value from the swap header to swap_add_extent, > but instead the device size rounded down to page granularity. This > activated the sanity checking in the core code that catches a too large > value in the swap header. > > Signed-off-by: Christoph Hellwig <[email protected]> > --- > block/fops.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/block/fops.c b/block/fops.c > index 453141801684..067e46299666 100644 > --- a/block/fops.c > +++ b/block/fops.c > @@ -951,7 +951,9 @@ static int blkdev_mmap_prepare(struct vm_area_desc *desc) > > static int blkdev_swap_activate(struct file *file, struct swap_info_struct > *sis) > { > - return add_swap_extent(sis, sis->max, 0); > + loff_t isize = i_size_read(bdev_file_inode(file));
Good catch! Reviewed-by: "Darrick J. Wong" <[email protected]> --D > + > + return add_swap_extent(sis, div_u64(isize, PAGE_SIZE), 0); > } > > const struct file_operations def_blk_fops = { > -- > 2.53.0 > > _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
