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: <005c01d9a296$513915b0$f3ab4110$@trustnetic.com>
Date: Mon, 19 Jun 2023 18:10:47 +0800
From: Jiawen Wu <jiawenwu@...stnetic.com>
To: "'Zhengchao Shao'" <shaozhengchao@...wei.com>,
	<netdev@...r.kernel.org>,
	<mengyuanlou@...-swift.com>,
	<davem@...emloft.net>,
	<edumazet@...gle.com>,
	<kuba@...nel.org>,
	<pabeni@...hat.com>
Cc: <weiyongjun1@...wei.com>,
	<yuehaibing@...wei.com>
Subject: RE: [PATCH net-next] net: txgbe: remove unused buffer in txgbe_calc_eeprom_checksum

On Monday, June 19, 2023 4:57 PM, Zhengchao Shao wrote:
> Half a year passed since commit 049fe5365324c ("net: txgbe: Add operations
> to interact with firmware") was submitted, the buffer in
> txgbe_calc_eeprom_checksum was not used. So remove it and the related
> branch codes.
> 
> Signed-off-by: Zhengchao Shao <shaozhengchao@...wei.com>
> ---
>  drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c | 31 +++++++------------
>  1 file changed, 11 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c
> index ebc46f3be056..173437c7a55f 100644
> --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c
> +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_hw.c
> @@ -161,33 +161,24 @@ static int txgbe_calc_eeprom_checksum(struct wx *wx, u16 *checksum)
>  {
>  	u16 *eeprom_ptrs = NULL;
>  	u32 buffer_size = 0;
> -	u16 *buffer = NULL;
>  	u16 *local_buffer;
>  	int status;
>  	u16 i;
> 
>  	wx_init_eeprom_params(wx);
> 
> -	if (!buffer) {
> -		eeprom_ptrs = kvmalloc_array(TXGBE_EEPROM_LAST_WORD, sizeof(u16),
> -					     GFP_KERNEL);
> -		if (!eeprom_ptrs)
> -			return -ENOMEM;
> -		/* Read pointer area */
> -		status = wx_read_ee_hostif_buffer(wx, 0,
> -						  TXGBE_EEPROM_LAST_WORD,
> -						  eeprom_ptrs);
> -		if (status != 0) {
> -			wx_err(wx, "Failed to read EEPROM image\n");
> -			kvfree(eeprom_ptrs);
> -			return status;
> -		}
> -		local_buffer = eeprom_ptrs;
> -	} else {
> -		if (buffer_size < TXGBE_EEPROM_LAST_WORD)
> -			return -EFAULT;
> -		local_buffer = buffer;
> +	eeprom_ptrs = kvmalloc_array(TXGBE_EEPROM_LAST_WORD, sizeof(u16),
> +				     GFP_KERNEL);
> +	if (!eeprom_ptrs)
> +		return -ENOMEM;
> +	/* Read pointer area */
> +	status = wx_read_ee_hostif_buffer(wx, 0, TXGBE_EEPROM_LAST_WORD, eeprom_ptrs);
> +	if (status != 0) {
> +		wx_err(wx, "Failed to read EEPROM image\n");
> +		kvfree(eeprom_ptrs);
> +		return status;
>  	}
> +	local_buffer = eeprom_ptrs;
> 
>  	for (i = 0; i < TXGBE_EEPROM_LAST_WORD; i++)
>  		if (i != wx->eeprom.sw_region_offset + TXGBE_EEPROM_CHECKSUM)
> --
> 2.34.1
> 

Reviewed-by: Jiawen Wu <jiawenwu@...stnetic.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ