All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Alejandro Lucero <alejandro.lucero-palau@amd.com>
Cc: kernel-janitors@vger.kernel.org, linux-net-drivers@amd.com
Subject: [bug report] sfc: add mport lookup based on driver's mport data
Date: Thu, 7 Aug 2025 19:00:07 +0300	[thread overview]
Message-ID: <aJTNh2A3i7JazSet@stanley.mountain> (raw)

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

                 reply	other threads:[~2025-08-07 16:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aJTNh2A3i7JazSet@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=alejandro.lucero-palau@amd.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-net-drivers@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.