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] [day] [month] [year] [list]
Message-ID: <0e1c2fd6-c792-a77c-4105-b7f6f5104357@molgen.mpg.de>
Date:   Thu, 28 Oct 2021 08:33:02 +0200
From:   Paul Menzel <pmenzel@...gen.mpg.de>
To:     Yang Guang <yang.guang5@....com.cn>
Cc:     Yang Guang <cgel.zte@...il.com>, Zeal Robot <zealci@....com.cn>,
        linux-raid@...r.kernel.org, linux-kernel@...r.kernel.org,
        Song Liu <song@...nel.org>
Subject: Re: [PATCH] raid5-ppl: use swap() to make code cleaner

Dear Yang,


Thank you for the patch.

On 28.10.21 03:00, Yang Guang wrote:
> Using swap() make it more readable.

make*s*

Maybe:

Use the macro `swap()` defined in `include/linux/minmax.h` to avoid 
opencoding it.

By the way, there is also the Coccinelle script 
`scripts/coccinelle/misc/swap.cocci`.

> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: Yang Guang <yang.guang5@....com.cn>
> ---
>   drivers/md/raid5-ppl.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/md/raid5-ppl.c b/drivers/md/raid5-ppl.c
> index 3ddc2aa0b530..4ab417915d7f 100644
> --- a/drivers/md/raid5-ppl.c
> +++ b/drivers/md/raid5-ppl.c
> @@ -1081,7 +1081,7 @@ static int ppl_load_distributed(struct ppl_log *log)
>   	struct ppl_conf *ppl_conf = log->ppl_conf;
>   	struct md_rdev *rdev = log->rdev;
>   	struct mddev *mddev = rdev->mddev;
> -	struct page *page, *page2, *tmp;
> +	struct page *page, *page2;
>   	struct ppl_header *pplhdr = NULL, *prev_pplhdr = NULL;
>   	u32 crc, crc_stored;
>   	u32 signature;
> @@ -1156,9 +1156,7 @@ static int ppl_load_distributed(struct ppl_log *log)
>   		prev_pplhdr_offset = pplhdr_offset;
>   		prev_pplhdr = pplhdr;
>   
> -		tmp = page;
> -		page = page2;
> -		page2 = tmp;
> +		swap(page, page2);
>   
>   		/* calculate next potential ppl offset */
>   		for (i = 0; i < le32_to_cpu(pplhdr->entries_count); i++)
> 


Kind regards,

Paul

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ