net: hinic: Fix warning-hinic_set_vlan_fliter() warn: variable dereferenced before check 'hwdev'
Subsystems (3)
Cai Huoqing
maintainerPATCH v2 1/1 net: hinic: Fix warning-hinic_set_vlan_fliter() warn: variable dereferenced before check 'hwdev'
'hwdev' is checked too late and hwdev will not be NULL, so remove the check
---v1->v2: Remove 'hwdev' check directly
v1 link: https://lore.kernel.org/lkml/[email protected]/
drivers/net/ethernet/huawei/hinic/hinic_port.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/ethernet/huawei/hinic/hinic_port.c +0 -3
@@ -456,9 +456,6 @@ int hinic_set_vlan_fliter(struct hinic_dev *nic_dev, u32 en)u16 out_size =sizeof (vlan_filter);int err; -if (!hwdev) -return -EINVAL ; - vlan_filter.func_idx =HINIC_HWIF_FUNC_IDX (hwif); vlan_filter.enable = en;
Signature · 1 line
2.34.1
Quoted 18 lines · Cai Huoqing
'hwdev' is checked too late and hwdev will not be NULL, so remove the check
Fixes 2acf960e3be6 ("net: hinic: Add support for configuration of rx-vlan-filter by ethtool")Reported-by Dan Carpenter <[email protected]>Signed-off-by Cai Huoqing <[email protected]>---
v1->v2: Remove 'hwdev' check directly
v1 link: https://lore.kernel.org/lkml/[email protected]/drivers/net/ethernet/huawei/hinic/hinic_port.c | 3 --- 1 file changed, 3 deletions(-)drivers/net/ethernet/huawei/hinic/hinic_port.c +0
-0
drivers/net/ethernet/huawei/hinic/hinic_port.c int hinic_set_vlan_fliter(struct hinic_dev *nic_dev, u32 en) · line 461
Quoted 9 lines
drivers/net/ethernet/huawei/hinic/hinic_port.c +0
-3@@ -456,9 +456,6 @@ int hinic_set_vlan_fliter(struct hinic_dev *nic_dev, u32 en)u16 out_size =sizeof (vlan_filter);int err; -if (!hwdev) -return -EINVAL ; - vlan_filter.func_idx =HINIC_HWIF_FUNC_IDX (hwif); vlan_filter.enable = en;
This patch was applied to netdev/net.git (main) by David S. Miller <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by David S. Miller <[email protected]>:
Quoted 8 lines · On Tue, 19 Sep 2023 10:27:15 +0800 you wrote:
'hwdev' is checked too late and hwdev will not be NULL, so remove the check
Fixes 2acf960e3be6 ("net: hinic: Add support for configuration of rx-vlan-filter by ethtool")Reported-by Dan Carpenter <[email protected]>Signed-off-by Cai Huoqing <[email protected]>[...]
Here is the summary with links:
- [v2] net: hinic: Fix warning-hinic_set_vlan_fliter() warn: variable dereferenced before check 'hwdev'
https://git.kernel.org/netdev/net/c/22b6e7f3d6d5
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html