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: <CACePvbW4AG5nyohmEMS1BrmJNm+Xtaz8_rCCGdSu9Y1iOG-nqQ@mail.gmail.com>
Date: Tue, 26 Aug 2025 19:12:10 -0700
From: Chris Li <chrisl@...nel.org>
To: Zi Yan <ziy@...dia.com>
Cc: Max Kellermann <max.kellermann@...os.com>, akpm@...ux-foundation.org, david@...hat.com, 
	lorenzo.stoakes@...cle.com, baolin.wang@...ux.alibaba.com, 
	Liam.Howlett@...cle.com, npache@...hat.com, ryan.roberts@....com, 
	dev.jain@....com, baohua@...nel.org, shikemeng@...weicloud.com, 
	kasong@...cent.com, nphamcs@...il.com, bhe@...hat.com, linux-mm@...ck.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] mm/swap: add BUG_ON(folio==NULL) to folios_put_refs()

On Tue, Aug 26, 2025 at 6:43 PM Zi Yan <ziy@...dia.com> wrote:
> > --- a/mm/swap.c
> > +++ b/mm/swap.c
> > @@ -952,6 +952,7 @@ void folios_put_refs(struct folio_batch *folios, unsigned int *refs)
> >       for (i = 0, j = 0; i < folios->nr; i++) {
> >               struct folio *folio = folios->folios[i];
> >               unsigned int nr_refs = refs ? refs[i] : 1;
> > +             BUG_ON(folio == NULL);
> >
> >               if (is_huge_zero_folio(folio))
> >                       continue;
>
> We are moving away from BUG_ON. It is better to use WARN_ON_ONCE and skip
> NULL values:
>
> if (WARN_ON_ONCE(!folio))
>         continue;

+1

Chris

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ