Skip to contentSkip to conversation

net: hinic: Add support for configuration of rx-vlan-filter by ethtool

bug report Dan Carpenter 1 participant 1 message Nov 18, 2022 Kernel janitors

lore
Share & tools
lore
#0 lore raw

Hello Cai Huoqing,

This is a semi-automatic email about new static checker warnings.

The patch 2acf960e3be6: "net: hinic: Add support for configuration of rx-vlan-filter by ethtool" from Nov 3, 2022, leads to the following Smatch complaint:

    drivers/net/ethernet/huawei/hinic/hinic_port.c:459 hinic_set_vlan_fliter()
                                                                      ^^^^

This should be "filter" instead of "fliter" (swap the li).

warn: variable dereferenced before check 'hwdev' (see line 453)

drivers/net/ethernet/huawei/hinic/hinic_port.c
452 struct hinic_hwdev *hwdev = nic_dev->hwdev;

   453		struct hinic_hwif *hwif = hwdev->hwif;
                                          ^^^^^^^^^^^

Dereference.

454 struct pci_dev *pdev = hwif->pdev;
455 struct hinic_vlan_filter vlan_filter;
456 u16 out_size = sizeof(vlan_filter);
457 int err;
458
459 if (!hwdev)

                    ^^^^^^

Checked too late.

460 return -EINVAL;
461

regards,
dan carpenter