[bug report] sfc: add mport lookup based on driver's mport data

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

 



Hello Alejandro Lucero,

Commit 5227adff37af ("sfc: add mport lookup based on driver's mport
data") from Feb 15, 2023 (linux-next), leads to the following Smatch
static checker warning:

	drivers/net/ethernet/sfc/mae.c:1035 efx_mae_lookup_mport()
	error: 'm' dereferencing possible ERR_PTR()

drivers/net/ethernet/sfc/mae.c
    1024 int efx_mae_lookup_mport(struct efx_nic *efx, u32 vf_idx, u32 *id)
    1025 {
    1026         struct ef100_nic_data *nic_data = efx->nic_data;
    1027         struct efx_mae *mae = efx->mae;
    1028         struct rhashtable_iter walk;
    1029         struct mae_mport_desc *m;
    1030         int rc = -ENOENT;
    1031 
    1032         rhashtable_walk_enter(&mae->mports_ht, &walk);
    1033         rhashtable_walk_start(&walk);
    1034         while ((m = rhashtable_walk_next(&walk)) != NULL) {

rhashtable_walk_next() returns NULL if we get to the end, but it
returns ERR_PTR(-EAGAIN) if the hashtable was resized.  I don't know the
code well enough to say if that's possible here.

--> 1035                 if (m->mport_type == MAE_MPORT_DESC_MPORT_TYPE_VNIC &&
    1036                     m->interface_idx == nic_data->local_mae_intf &&
    1037                     m->pf_idx == 0 &&
    1038                     m->vf_idx == vf_idx) {
    1039                         *id = m->mport_id;
    1040                         rc = 0;
    1041                         break;
    1042                 }
    1043         }
    1044         rhashtable_walk_stop(&walk);
    1045         rhashtable_walk_exit(&walk);
    1046         return rc;
    1047 }

regards,
dan carpenter




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux