lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260114121654.1029110-1-clm@meta.com>
Date: Wed, 14 Jan 2026 04:16:51 -0800
From: Chris Mason <clm@...a.com>
To: Kairui Song <ryncsn@...il.com>
CC: Chris Mason <clm@...a.com>, <linux-mm@...ck.org>,
        Andrew Morton
	<akpm@...ux-foundation.org>,
        Baoquan He <bhe@...hat.com>, Barry Song
	<baohua@...nel.org>,
        Chris Li <chrisl@...nel.org>, Nhat Pham
	<nphamcs@...il.com>,
        Yosry Ahmed <yosry.ahmed@...ux.dev>,
        David Hildenbrand
	<david@...nel.org>,
        Johannes Weiner <hannes@...xchg.org>,
        Youngjun Park
	<youngjun.park@....com>,
        Hugh Dickins <hughd@...gle.com>,
        Baolin Wang
	<baolin.wang@...ux.alibaba.com>,
        Ying Huang <ying.huang@...ux.alibaba.com>,
        Kemeng Shi <shikemeng@...weicloud.com>,
        Lorenzo Stoakes
	<lorenzo.stoakes@...cle.com>,
        "Matthew Wilcox (Oracle)"
	<willy@...radead.org>,
        <linux-kernel@...r.kernel.org>, Kairui Song
	<kasong@...cent.com>,
        <linux-pm@...r.kernel.org>,
        "Rafael J. Wysocki (Intel)"
	<rafael@...nel.org>
Subject: Re: [PATCH v5 14/19] mm, swap: cleanup swap entry management workflow

On Sat, 20 Dec 2025 03:43:43 +0800 Kairui Song <ryncsn@...il.com> wrote:

Hi everyone,

I ran mm-new through the AI review prompts, and this one was flagged:

> diff --git a/kernel/power/swap.c b/kernel/power/swap.c
> index 8050e51828351..036489d3b01a9 100644
> --- a/kernel/power/swap.c
> +++ b/kernel/power/swap.c

[ ... ]

> @@ -186,6 +186,7 @@ sector_t alloc_swapdev_block(int swap)
>
>  void free_all_swap_pages(int swap)
>  {
> +	unsigned long offset;
>  	struct rb_node *node;
>
>  	/*
> @@ -197,8 +198,9 @@ void free_all_swap_pages(int swap)
>
>  		ext = rb_entry(node, struct swsusp_extent, node);
>  		rb_erase(node, &swsusp_extents);
> -		swap_free_nr(swp_entry(swap, ext->start),
> -			     ext->end - ext->start + 1);
> +
> +		for (offset = ext->start; offset < ext->end; offset++)
> +			swap_free_hibernation_slot(swp_entry(swap, offset));
                                           ^^^^^^^^^^^

Is this loop missing the final slot at ext->end?

The old code freed (ext->end - ext->start + 1) entries, which is the
inclusive range [ext->start, ext->end]. Looking at swsusp_extents_insert(),
when a single slot is inserted it sets ext->start = ext->end = offset, and
merging extends the range by incrementing ext->end or decrementing
ext->start. This means ext->end is inclusive.

The new loop uses "offset < ext->end" which iterates [ext->start, ext->end),
missing the slot at ext->end. Should this be "offset <= ext->end" instead?



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ