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: <CAMZfGtXbSgLQD2MSda0YoXNUioAzVhQmH5YpSsFLZ0vSMiEHUg@mail.gmail.com>
Date:   Wed, 10 Nov 2021 12:15:57 +0800
From:   Muchun Song <songmuchun@...edance.com>
To:     Yihao Han <hanyihao@...o.com>
Cc:     SeongJae Park <sj@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux Memory Management List <linux-mm@...ck.org>,
        LKML <linux-kernel@...r.kernel.org>, kernel@...o.com
Subject: Re: [PATCH] mm/damon/vaddr: use swap() to make code cleaner

On Wed, Nov 10, 2021 at 11:32 AM Yihao Han <hanyihao@...o.com> wrote:
>
> Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
> opencoding it.
>
> Signed-off-by: Yihao Han <hanyihao@...o.com>
> ---
>  mm/damon/vaddr.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/mm/damon/vaddr.c b/mm/damon/vaddr.c
> index 35fe49080ee9..414d9fb9c827 100644
> --- a/mm/damon/vaddr.c
> +++ b/mm/damon/vaddr.c
> @@ -100,11 +100,7 @@ static unsigned long sz_range(struct damon_addr_range *r)
>  static void swap_ranges(struct damon_addr_range *r1,
>                         struct damon_addr_range *r2)
>  {
> -       struct damon_addr_range tmp;
> -
> -       tmp = *r1;
> -       *r1 = *r2;
> -       *r2 = tmp;
> +       swap(*r1, *r2);

IMHO, I suggest removing swap_ranges() completely
since it's only a wrapper of swap() after your changes.
The caller can invoke swap() directly.

Thanks.

>  }
>
>  /*
> --
> 2.17.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ