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: <20211108110509.yjn4o22en2w22uwp@gmail.com>
Date:   Mon, 8 Nov 2021 11:05:09 +0000
From:   Martin Habets <habetsm.xilinx@...il.com>
To:     davidcomponentone@...il.com
Cc:     ecree.xilinx@...il.com, davem@...emloft.net, kuba@...nel.org,
        hkallweit1@...il.com, bhelgaas@...gle.com, yuehaibing@...wei.com,
        arnd@...db.de, yang.guang5@....com.cn, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH] sfc: use swap() to make code cleaner

On Thu, Nov 04, 2021 at 02:53:50PM +0800, davidcomponentone@...il.com wrote:
> From: Yang Guang <yang.guang5@....com.cn>
> 
> Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
> opencoding it.
> 
> Reported-by: Zeal Robot <zealci@....com.cn>
> Signed-off-by: Yang Guang <yang.guang5@....com.cn>
> ---
>  drivers/net/ethernet/sfc/falcon/efx.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/sfc/falcon/efx.c b/drivers/net/ethernet/sfc/falcon/efx.c
> index c68837a951f4..314c9c69eb0e 100644
> --- a/drivers/net/ethernet/sfc/falcon/efx.c
> +++ b/drivers/net/ethernet/sfc/falcon/efx.c
> @@ -817,9 +817,7 @@ ef4_realloc_channels(struct ef4_nic *efx, u32 rxq_entries, u32 txq_entries)
>  	efx->rxq_entries = rxq_entries;
>  	efx->txq_entries = txq_entries;
>  	for (i = 0; i < efx->n_channels; i++) {
> -		channel = efx->channel[i];
> -		efx->channel[i] = other_channel[i];
> -		other_channel[i] = channel;
> +		swap(efx->channel[i], other_channel[i]);
>  	}

The braces are no longer needed. Remove those.

Martin

>  
>  	/* Restart buffer table allocation */
> @@ -863,9 +861,7 @@ ef4_realloc_channels(struct ef4_nic *efx, u32 rxq_entries, u32 txq_entries)
>  	efx->rxq_entries = old_rxq_entries;
>  	efx->txq_entries = old_txq_entries;
>  	for (i = 0; i < efx->n_channels; i++) {
> -		channel = efx->channel[i];
> -		efx->channel[i] = other_channel[i];
> -		other_channel[i] = channel;
> +		swap(efx->channel[i], other_channel[i]);
>  	}
>  	goto out;
>  }
> -- 
> 2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ