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: <17ae2088c08d34a17db8eeb1fa2821d686198a5b.camel@gmail.com>
Date: Wed, 31 Jul 2024 10:02:22 -0700
From: Alexander H Duyck <alexander.duyck@...il.com>
To: Yunsheng Lin <linyunsheng@...wei.com>
Cc: davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com, 
	netdev@...r.kernel.org, linux-kernel@...r.kernel.org, Andrew Morton
	 <akpm@...ux-foundation.org>, linux-mm@...ck.org
Subject: Re: [RFC v11 08/14] mm: page_frag: some minor refactoring before
 adding new API

On Wed, 2024-07-31 at 20:35 +0800, Yunsheng Lin wrote:
> On 2024/7/30 23:12, Alexander H Duyck wrote:
> 
> ...
> 
> > >         }
> > > 
> > >         nc->pagecnt_bias--;
> > >         nc->remaining = remaining - fragsz;
> > > 
> > >         return encoded_page_address(encoded_va) +
> > >                 (page_frag_cache_page_size(encoded_va) - remaining);
> > 
> > Parenthesis here shouldn't be needed, addition and subtractions
> > operations can happen in any order with the result coming out the same.
> 
> I am playing safe to avoid overflow here, as I am not sure if the allocator
> will give us the last page. For example, '0xfffffffffffff000 + 0x1000' will
> have a overflow.

So what if it does though? When you subtract remaining it will
underflow and go back to the correct value shouldn't it?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ