linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/net/ethernet/chelsio/cxgb4/sge.c:2566 cxgb4_ethofld_send_flowc() warn: missing error code 'ret'
@ 2022-03-10  7:49 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2022-03-10  7:49 UTC (permalink / raw)
  To: kbuild, Íñigo Huguet; +Cc: lkp, kbuild-all, linux-kernel

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   330f4c53d3c2d8b11d86ec03a964b86dc81452f5
commit: 52bfcdd87e83d9e69d22da5f26b1512ffc81deed net:CXGB4: fix leak if sk_buff is not used
config: microblaze-randconfig-m031-20220308 (https://download.01.org/0day-ci/archive/20220309/202203092354.8QMmp2o7-lkp@intel.com/config)
compiler: microblaze-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/net/ethernet/chelsio/cxgb4/sge.c:2566 cxgb4_ethofld_send_flowc() warn: missing error code 'ret'

vim +/ret +2566 drivers/net/ethernet/chelsio/cxgb4/sge.c

0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2535  int cxgb4_ethofld_send_flowc(struct net_device *dev, u32 eotid, u32 tc)
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2536  {
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2537  	struct port_info *pi = netdev2pinfo(dev);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2538  	struct adapter *adap = netdev2adap(dev);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2539  	enum sge_eosw_state next_state;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2540  	struct sge_eosw_txq *eosw_txq;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2541  	u32 len, len16, nparams = 6;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2542  	struct fw_flowc_wr *flowc;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2543  	struct eotid_entry *entry;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2544  	struct sge_ofld_rxq *rxq;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2545  	struct sk_buff *skb;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2546  	int ret = 0;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2547  
a422d5ff6defb1c Gustavo A. R. Silva 2020-06-19  2548  	len = struct_size(flowc, mnemval, nparams);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2549  	len16 = DIV_ROUND_UP(len, 16);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2550  
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2551  	entry = cxgb4_lookup_eotid(&adap->tids, eotid);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2552  	if (!entry)
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2553  		return -ENOMEM;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2554  
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2555  	eosw_txq = (struct sge_eosw_txq *)entry->data;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2556  	if (!eosw_txq)
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2557  		return -ENOMEM;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2558  
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2559  	skb = alloc_skb(len, GFP_KERNEL);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2560  	if (!skb)
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2561  		return -ENOMEM;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2562  
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2563  	spin_lock_bh(&eosw_txq->lock);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2564  	if (tc != FW_SCHED_CLS_NONE) {
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2565  		if (eosw_txq->state != CXGB4_EO_STATE_CLOSED)
52bfcdd87e83d9e Íñigo Huguet        2021-05-05 @2566  			goto out_free_skb;
                                                                        ^^^^^^^^^^^^^^^^^^

0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2567  
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2568  		next_state = CXGB4_EO_STATE_FLOWC_OPEN_SEND;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2569  	} else {
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2570  		if (eosw_txq->state != CXGB4_EO_STATE_ACTIVE)
52bfcdd87e83d9e Íñigo Huguet        2021-05-05  2571  			goto out_free_skb;
                                                                        ^^^^^^^^^^^^^^^^^
No error code.  Are these errors?  It's hard to tell from the context.

0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2572  
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2573  		next_state = CXGB4_EO_STATE_FLOWC_CLOSE_SEND;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2574  	}
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2575  
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2576  	flowc = __skb_put(skb, len);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2577  	memset(flowc, 0, len);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2578  
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2579  	rxq = &adap->sge.eohw_rxq[eosw_txq->hwqid];
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2580  	flowc->flowid_len16 = cpu_to_be32(FW_WR_LEN16_V(len16) |
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2581  					  FW_WR_FLOWID_V(eosw_txq->hwtid));
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2582  	flowc->op_to_nparams = cpu_to_be32(FW_WR_OP_V(FW_FLOWC_WR) |
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2583  					   FW_FLOWC_WR_NPARAMS_V(nparams) |
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2584  					   FW_WR_COMPL_V(1));
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2585  	flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_PFNVFN;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2586  	flowc->mnemval[0].val = cpu_to_be32(FW_PFVF_CMD_PFN_V(adap->pf));
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2587  	flowc->mnemval[1].mnemonic = FW_FLOWC_MNEM_CH;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2588  	flowc->mnemval[1].val = cpu_to_be32(pi->tx_chan);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2589  	flowc->mnemval[2].mnemonic = FW_FLOWC_MNEM_PORT;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2590  	flowc->mnemval[2].val = cpu_to_be32(pi->tx_chan);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2591  	flowc->mnemval[3].mnemonic = FW_FLOWC_MNEM_IQID;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2592  	flowc->mnemval[3].val = cpu_to_be32(rxq->rspq.abs_id);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2593  	flowc->mnemval[4].mnemonic = FW_FLOWC_MNEM_SCHEDCLASS;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2594  	flowc->mnemval[4].val = cpu_to_be32(tc);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2595  	flowc->mnemval[5].mnemonic = FW_FLOWC_MNEM_EOSTATE;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2596  	flowc->mnemval[5].val = cpu_to_be32(tc == FW_SCHED_CLS_NONE ?
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2597  					    FW_FLOWC_MNEM_EOSTATE_CLOSING :
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2598  					    FW_FLOWC_MNEM_EOSTATE_ESTABLISHED);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2599  
69422a7e5d578aa Rahul Lakkireddy    2020-04-30  2600  	/* Free up any pending skbs to ensure there's room for
69422a7e5d578aa Rahul Lakkireddy    2020-04-30  2601  	 * termination FLOWC.
69422a7e5d578aa Rahul Lakkireddy    2020-04-30  2602  	 */
69422a7e5d578aa Rahul Lakkireddy    2020-04-30  2603  	if (tc == FW_SCHED_CLS_NONE)
69422a7e5d578aa Rahul Lakkireddy    2020-04-30  2604  		eosw_txq_flush_pending_skbs(eosw_txq);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2605  
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2606  	ret = eosw_txq_enqueue(eosw_txq, skb);
52bfcdd87e83d9e Íñigo Huguet        2021-05-05  2607  	if (ret)
52bfcdd87e83d9e Íñigo Huguet        2021-05-05  2608  		goto out_free_skb;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2609  
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2610  	eosw_txq->state = next_state;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2611  	eosw_txq->flowc_idx = eosw_txq->pidx;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2612  	eosw_txq_advance(eosw_txq, 1);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2613  	ethofld_xmit(dev, eosw_txq);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2614  
52bfcdd87e83d9e Íñigo Huguet        2021-05-05  2615  	spin_unlock_bh(&eosw_txq->lock);
52bfcdd87e83d9e Íñigo Huguet        2021-05-05  2616  	return 0;
52bfcdd87e83d9e Íñigo Huguet        2021-05-05  2617  
52bfcdd87e83d9e Íñigo Huguet        2021-05-05  2618  out_free_skb:
52bfcdd87e83d9e Íñigo Huguet        2021-05-05  2619  	dev_consume_skb_any(skb);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2620  	spin_unlock_bh(&eosw_txq->lock);
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2621  	return ret;
0e395b3cb1fb82f Rahul Lakkireddy    2019-11-07  2622  }

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


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

only message in thread, other threads:[~2022-03-10  7:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-10  7:49 drivers/net/ethernet/chelsio/cxgb4/sge.c:2566 cxgb4_ethofld_send_flowc() warn: missing error code 'ret' Dan Carpenter

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).