linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* re: octeontx2-af: Introduce internal packet switching
@ 2021-07-22 18:47 Colin Ian King
  0 siblings, 0 replies; only message in thread
From: Colin Ian King @ 2021-07-22 18:47 UTC (permalink / raw)
  To: Subbaraya Sundeep
  Cc: Sunil Goutham, Linu Cherian, Linu Cherian, Jerin Jacob,
	hariprasad, David S. Miller, Jakub Kicinski, netdev,
	linux-kernel

Hi,

Static analysis of linux-next with Coverity has found a couple of
uninitialized variable issues in the following commit:

commit 23109f8dd06d0bd04c9360cf7c501c97b0ab1545
Author: Subbaraya Sundeep <sbhatta@marvell.com>
Date:   Mon Jul 19 14:29:34 2021 +0530

    octeontx2-af: Introduce internal packet switching

The analysis is as follows:

195void rvu_switch_disable(struct rvu *rvu)
196{
197        struct npc_delete_flow_req uninstall_req = { 0 };
198        struct npc_mcam_free_entry_req free_req = { 0 };
199        struct rvu_switch *rswitch = &rvu->rswitch;
200        struct rvu_hwinfo *hw = rvu->hw;

   1. var_decl: Declaring variable numvfs without initializer.

201        int pf, vf, numvfs, hwvf;
202        struct msg_rsp rsp;
203        u16 pcifunc;
204        int err;
205

   2. Condition !rswitch->used_entries, taking false branch.

206        if (!rswitch->used_entries)
207                return;
208

   3. Condition pf < hw->total_pfs, taking true branch.

209        for (pf = 1; pf < hw->total_pfs; pf++) {

   4. Condition !is_pf_cgxmapped(rvu, pf), taking false branch.

210                if (!is_pf_cgxmapped(rvu, pf))
211                        continue;
212
213                pcifunc = pf << 10;
214                err = rvu_switch_install_rx_rule(rvu, pcifunc, 0xFFF);

   5. Condition err, taking false branch.

215                if (err)
216                        dev_err(rvu->dev,
217                                "Reverting RX rule for PF%d
failed(%d)\n",
218                                pf, err);
219

   Uninitialized scalar variable (UNINIT)
   6. uninit_use: Using uninitialized value numvfs.

   Uninitialized scalar variable (UNINIT)
   9. uninit_use: Using uninitialized value hwvf.

220                for (vf = 0; vf < numvfs; vf++, hwvf++) {
221                        pcifunc = pf << 10 | ((vf + 1) & 0x3FF);
222                        err = rvu_switch_install_rx_rule(rvu,
pcifunc, 0xFFF);

   7. Condition err, taking false branch.

223                        if (err)
224                                dev_err(rvu->dev,
225                                        "Reverting RX rule for
PF%dVF%d failed(%d)\n",
226                                        pf, vf, err);
227                }

   8. Jumping back to the beginning of the loop.

228        }
229
230        uninstall_req.start = rswitch->start_entry;
231        uninstall_req.end =  rswitch->start_entry +
rswitch->used_entries - 1;
232        free_req.all = 1;
233        rvu_mbox_handler_npc_delete_flow(rvu, &uninstall_req, &rsp);
234        rvu_mbox_handler_npc_mcam_free_entry(rvu, &free_req, &rsp);
235        rswitch->used_entries = 0;
236        kfree(rswitch->entry2pcifunc);
237}

Colin

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-22 18:47 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-22 18:47 octeontx2-af: Introduce internal packet switching Colin Ian King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).