Commit 468164dd authored by Colin Ian King's avatar Colin Ian King Committed by Zheng Zengkai
Browse files

net: hns3: remove redundant null check of an array

mainline inclusion
from mainline-v5.12-rc1-dontuse
commit 8f8a42ff
category: bugfix
bugzilla: 173966
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=8f8a42ff003aaa3c1424923154c9a92f3bd4c634



----------------------------------------------------------------------

The null check of filp->f_path.dentry->d_iname is redundant because
it is an array of DNAME_INLINE_LEN chars and cannot be a null. Fix
this by removing the null check.

Addresses-Coverity: ("Array compared against 0")
Fixes: 04987ca1 ("net: hns3: add debugfs support for tm nodes, priority and qset info")
Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
Reviewed-by: default avatarJesse Brandeburg <jesse.brandeburg@intel.com>
Link: https://lore.kernel.org/r/20210203131040.21656-1-colin.king@canonical.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Reviewed-by: default avatarYongxin Li <liyongxin1@huawei.com>
Signed-off-by: default avatarJunxin Chen <chenjunxin1@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 99b8b62e
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -494,9 +494,6 @@ static ssize_t hns3_dbg_read(struct file *filp, char __user *buffer,
	ssize_t size = 0;
	int ret = 0;

	if (!filp->f_path.dentry->d_iname)
		return -EINVAL;

	read_buf = kzalloc(HNS3_DBG_READ_LEN, GFP_KERNEL);
	if (!read_buf)
		return -ENOMEM;