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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <856dbc05-5046-04c8-cf6f-9d0b13e9d229@suse.cz>
Date:   Tue, 23 May 2023 15:13:43 +0200
From:   Vlastimil Babka <vbabka@...e.cz>
To:     Lorenzo Stoakes <lstoakes@...il.com>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org,
        Andrew Morton <akpm@...ux-foundation.org>
Cc:     Mike Rapoport <rppt@...nel.org>,
        "Liam R . Howlett" <Liam.Howlett@...cle.com>
Subject: Re: [PATCH] mm/mmap: refactor mlock_future_check()

On 5/22/23 10:24, Lorenzo Stoakes wrote:
> In all but one instance, mlock_future_check() is treated as a boolean
> function despite returning an error code. In one instance, this error code
> is ignored and replaced with -ENOMEM.
> 
> This is confusing, and the inversion of true -> failure, false -> success
> is not warranted. Convert the function to a bool, lightly refactor and
> return true if the check passes, false if not.
> 
> Signed-off-by: Lorenzo Stoakes <lstoakes@...il.com>

Acked-by: Vlastimil Babka <vbabka@...e.cz>

> ---
>  mm/internal.h  |  4 ++--
>  mm/mmap.c      | 33 +++++++++++++++++----------------
>  mm/mremap.c    |  2 +-
>  mm/secretmem.c |  2 +-
>  4 files changed, 21 insertions(+), 20 deletions(-)
> 
> diff --git a/mm/internal.h b/mm/internal.h
> index bb6542279599..66dd214b302a 100644
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -576,8 +576,8 @@ extern long populate_vma_page_range(struct vm_area_struct *vma,
>  extern long faultin_vma_page_range(struct vm_area_struct *vma,
>  				   unsigned long start, unsigned long end,
>  				   bool write, int *locked);
> -extern int mlock_future_check(struct mm_struct *mm, unsigned long flags,
> -			      unsigned long len);
> +extern bool mlock_future_check(struct mm_struct *mm, unsigned long flags,
> +			       unsigned long bytes);

This would have been good opportunity to drop the extern.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ