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: <20250902180843.5ba05bf2@kernel.org>
Date: Tue, 2 Sep 2025 18:08:43 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Fan Gong <gongfan1@...wei.com>
Cc: Zhu Yikai <zhuyikai1@...artners.com>, <netdev@...r.kernel.org>,
 <linux-kernel@...r.kernel.org>, "David S. Miller" <davem@...emloft.net>,
 Eric Dumazet <edumazet@...gle.com>, 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>, Vadim Fedorenko <vadim.fedorenko@...ux.dev>, Suman
 Ghosh <sumang@...vell.com>, Przemek Kitszel <przemyslaw.kitszel@...el.com>,
 Joe Damato <jdamato@...tly.com>, Christophe JAILLET
 <christophe.jaillet@...adoo.fr>
Subject: Re: [PATCH net-next v03 02/14] hinic3: HW management interfaces

On Sat, 30 Aug 2025 16:08:41 +0800 Fan Gong wrote:
> +int hinic3_init_cfg_mgmt(struct hinic3_hwdev *hwdev)
> +{
> +	struct hinic3_cfg_mgmt_info *cfg_mgmt;
> +	int err;
> +
> +	if (!hwdev->hwif->attr.num_ceqs) {
> +		dev_err(hwdev->dev, "Ceq num cfg in fw is zero\n");
> +		return -EINVAL;
> +	}

The input checking in most of the functions looks like defensive
programming. The values should be checked when they are set / loaded,
not on input to random functions. Defensive programming should be
avoided in the kernel (meaning, unless you can point out actual callers
which need the validation, and can explain why doing the check in the
callee rather than the caller is cleaner -- the check should be in the
caller).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ