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: <8351e9e6-644e-4ff5-8ba1-fc643640c033@linux.dev>
Date: Tue, 26 Aug 2025 16:49:57 +0100
From: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
To: Fan Gong <gongfan1@...wei.com>, Zhu Yikai <zhuyikai1@...artners.com>
Cc: netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
 "David S. Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
 Simon Horman <horms@...nel.org>, Andrew Lunn <andrew+netdev@...n.ch>,
 linux-doc@...r.kernel.org, Jonathan Corbet <corbet@....net>,
 Bjorn Helgaas <helgaas@...nel.org>, luosifu <luosifu@...wei.com>,
 Xin Guo <guoxin09@...wei.com>, Shen Chenyang <shenchenyang1@...ilicon.com>,
 Zhou Shuai <zhoushuai28@...wei.com>, Wu Like <wulike1@...wei.com>,
 Shi Jing <shijing34@...wei.com>, Meny Yossefi <meny.yossefi@...wei.com>,
 Gur Stavi <gur.stavi@...wei.com>, Lee Trager <lee@...ger.us>,
 Michael Ellerman <mpe@...erman.id.au>, Suman Ghosh <sumang@...vell.com>,
 Przemek Kitszel <przemyslaw.kitszel@...el.com>,
 Christophe JAILLET <christophe.jaillet@...adoo.fr>
Subject: Re: [PATCH net-next v01 06/12] hinic3: Nic_io initialization

On 26/08/2025 10:05, Fan Gong wrote:
> Add nic_io initialization to enable NIC service, initialize function table
> and negotiate activation of NIC features.
> 
> Co-developed-by: Xin Guo <guoxin09@...wei.com>
> Signed-off-by: Xin Guo <guoxin09@...wei.com>
> Co-developed-by: Zhu Yikai <zhuyikai1@...artners.com>
> Signed-off-by: Zhu Yikai <zhuyikai1@...artners.com>
> Signed-off-by: Fan Gong <gongfan1@...wei.com>
> ---
>   .../net/ethernet/huawei/hinic3/hinic3_hwdev.c | 15 +++++
>   .../ethernet/huawei/hinic3/hinic3_nic_cfg.c   | 24 ++++++++
>   .../ethernet/huawei/hinic3/hinic3_nic_cfg.h   |  2 +
>   .../ethernet/huawei/hinic3/hinic3_nic_io.c    | 61 ++++++++++++++++++-
>   4 files changed, 99 insertions(+), 3 deletions(-)

[...]

> +int hinic3_init_function_table(struct hinic3_nic_dev *nic_dev)
> +{
> +	struct hinic3_nic_io *nic_io = nic_dev->nic_io;
> +	struct l2nic_func_tbl_cfg func_tbl_cfg;
> +	u32 cfg_bitmap;
> +
> +	func_tbl_cfg.mtu = 0x3FFF; /* default, max mtu */
> +	func_tbl_cfg.rx_wqe_buf_size = nic_io->rx_buf_len;

func_tbl_cfg can still have garbage in rsvd field, which then will be
passed down to FW. Better to init it to 0 to avoid exposing data.

> +
> +	cfg_bitmap = BIT(L2NIC_FUNC_TBL_CFG_INIT) |
> +		     BIT(L2NIC_FUNC_TBL_CFG_MTU) |
> +		     BIT(L2NIC_FUNC_TBL_CFG_RX_BUF_SIZE);
> +
> +	return hinic3_set_function_table(nic_dev->hwdev, cfg_bitmap,
> +					 &func_tbl_cfg);
> +}
> +

[...]

> +static int init_nic_io(struct hinic3_nic_io **nic_io)
> +{
> +	*nic_io = kzalloc(sizeof(**nic_io), GFP_KERNEL);
> +	if (!(*nic_io))
> +		return -ENOMEM;
> +
> +	return 0;
> +}
> +
>   int hinic3_init_nic_io(struct hinic3_nic_dev *nic_dev)
>   {
> -	/* Completed by later submission due to LoC limit. */
> -	return -EFAULT;
> +	struct hinic3_hwdev *hwdev = nic_dev->hwdev;
> +	struct hinic3_nic_io *nic_io;
> +	int err;
> +
> +	err = init_nic_io(&nic_io);
> +	if (err)
> +		return err;

there is no need for init_nic_io(). you can call kzalloc() directly
in hinic3_init_nic_io() and return -ENOMEM in case of NULL return

> +
> +	nic_dev->nic_io = nic_io;
> +

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ