Re: [PATCH net-next v03 02/14] hinic3: HW management interfaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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).




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux