CC: [email protected]
BCC: [email protected]
CC: [email protected]
TO: "Íñigo Huguet" <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   52deda9551a01879b3562e7b41748e85c591f14c
commit: 52bfcdd87e83d9e69d22da5f26b1512ffc81deed net:CXGB4: fix leak if sk_buff 
is not used
date:   11 months ago
:::::: branch date: 2 hours ago
:::::: commit date: 11 months ago
config: riscv-randconfig-m031-20220324 
(https://download.01.org/0day-ci/archive/20220325/[email protected]/config)
compiler: riscv32-linux-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

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

Old smatch warnings:
drivers/net/ethernet/chelsio/cxgb4/sge.c:4169 process_intrq() warn: potential 
spectre issue 'adap->sge.ingr_map' [w]
drivers/net/ethernet/chelsio/cxgb4/sge.c:4484 t4_sge_alloc_rxq() warn: 
potential spectre issue 'adap->sge.ingr_map' [w]
drivers/net/ethernet/chelsio/cxgb4/sge.c:4491 t4_sge_alloc_rxq() warn: 
potential spectre issue 'adap->sge.egr_map' [w]

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

69422a7e5d578a Rahul Lakkireddy    2020-04-30  2524  
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2525  /**
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2526   * 
cxgb4_ethofld_send_flowc - Send ETHOFLD flowc request to bind eotid to tc.
29bbf5d7f5efe8 Rahul Lakkireddy    2020-06-24  2527   * @dev: netdevice
29bbf5d7f5efe8 Rahul Lakkireddy    2020-06-24  2528   * @eotid: ETHOFLD tid to 
bind/unbind
29bbf5d7f5efe8 Rahul Lakkireddy    2020-06-24  2529   * @tc: traffic class. If 
set to FW_SCHED_CLS_NONE, then unbinds the @eotid
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2530   *
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2531   * Send a FLOWC work 
request to bind an ETHOFLD TID to a traffic class.
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2532   * If @tc is set to 
FW_SCHED_CLS_NONE, then the @eotid is unbound from
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2533   * a traffic class.
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2534   */
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2535  int 
cxgb4_ethofld_send_flowc(struct net_device *dev, u32 eotid, u32 tc)
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2536  {
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2537     struct port_info *pi = 
netdev2pinfo(dev);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2538     struct adapter *adap = 
netdev2adap(dev);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2539     enum sge_eosw_state 
next_state;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2540     struct sge_eosw_txq 
*eosw_txq;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2541     u32 len, len16, nparams 
= 6;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2542     struct fw_flowc_wr 
*flowc;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2543     struct eotid_entry 
*entry;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2544     struct sge_ofld_rxq 
*rxq;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2545     struct sk_buff *skb;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2546     int ret = 0;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2547  
a422d5ff6defb1 Gustavo A. R. Silva 2020-06-19  2548     len = 
struct_size(flowc, mnemval, nparams);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2549     len16 = 
DIV_ROUND_UP(len, 16);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2550  
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2551     entry = 
cxgb4_lookup_eotid(&adap->tids, eotid);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2552     if (!entry)
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2553             return -ENOMEM;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2554  
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2555     eosw_txq = (struct 
sge_eosw_txq *)entry->data;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2556     if (!eosw_txq)
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2557             return -ENOMEM;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2558  
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2559     skb = alloc_skb(len, 
GFP_KERNEL);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2560     if (!skb)
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2561             return -ENOMEM;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2562  
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2563     
spin_lock_bh(&eosw_txq->lock);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2564     if (tc != 
FW_SCHED_CLS_NONE) {
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2565             if 
(eosw_txq->state != CXGB4_EO_STATE_CLOSED)
52bfcdd87e83d9 Íñigo Huguet        2021-05-05 @2566                     goto 
out_free_skb;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2567  
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2568             next_state = 
CXGB4_EO_STATE_FLOWC_OPEN_SEND;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2569     } else {
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2570             if 
(eosw_txq->state != CXGB4_EO_STATE_ACTIVE)
52bfcdd87e83d9 Íñigo Huguet        2021-05-05  2571                     goto 
out_free_skb;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2572  
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2573             next_state = 
CXGB4_EO_STATE_FLOWC_CLOSE_SEND;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2574     }
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2575  
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2576     flowc = __skb_put(skb, 
len);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2577     memset(flowc, 0, len);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2578  
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2579     rxq = 
&adap->sge.eohw_rxq[eosw_txq->hwqid];
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2580     flowc->flowid_len16 = 
cpu_to_be32(FW_WR_LEN16_V(len16) |
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2581                             
          FW_WR_FLOWID_V(eosw_txq->hwtid));
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2582     flowc->op_to_nparams = 
cpu_to_be32(FW_WR_OP_V(FW_FLOWC_WR) |
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2583                             
           FW_FLOWC_WR_NPARAMS_V(nparams) |
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2584                             
           FW_WR_COMPL_V(1));
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2585     
flowc->mnemval[0].mnemonic = FW_FLOWC_MNEM_PFNVFN;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2586     flowc->mnemval[0].val = 
cpu_to_be32(FW_PFVF_CMD_PFN_V(adap->pf));
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2587     
flowc->mnemval[1].mnemonic = FW_FLOWC_MNEM_CH;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2588     flowc->mnemval[1].val = 
cpu_to_be32(pi->tx_chan);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2589     
flowc->mnemval[2].mnemonic = FW_FLOWC_MNEM_PORT;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2590     flowc->mnemval[2].val = 
cpu_to_be32(pi->tx_chan);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2591     
flowc->mnemval[3].mnemonic = FW_FLOWC_MNEM_IQID;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2592     flowc->mnemval[3].val = 
cpu_to_be32(rxq->rspq.abs_id);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2593     
flowc->mnemval[4].mnemonic = FW_FLOWC_MNEM_SCHEDCLASS;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2594     flowc->mnemval[4].val = 
cpu_to_be32(tc);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2595     
flowc->mnemval[5].mnemonic = FW_FLOWC_MNEM_EOSTATE;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2596     flowc->mnemval[5].val = 
cpu_to_be32(tc == FW_SCHED_CLS_NONE ?
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2597                             
            FW_FLOWC_MNEM_EOSTATE_CLOSING :
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2598                             
            FW_FLOWC_MNEM_EOSTATE_ESTABLISHED);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2599  
69422a7e5d578a Rahul Lakkireddy    2020-04-30  2600     /* Free up any pending 
skbs to ensure there's room for
69422a7e5d578a Rahul Lakkireddy    2020-04-30  2601      * termination FLOWC.
69422a7e5d578a Rahul Lakkireddy    2020-04-30  2602      */
69422a7e5d578a Rahul Lakkireddy    2020-04-30  2603     if (tc == 
FW_SCHED_CLS_NONE)
69422a7e5d578a Rahul Lakkireddy    2020-04-30  2604             
eosw_txq_flush_pending_skbs(eosw_txq);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2605  
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2606     ret = 
eosw_txq_enqueue(eosw_txq, skb);
52bfcdd87e83d9 Íñigo Huguet        2021-05-05  2607     if (ret)
52bfcdd87e83d9 Íñigo Huguet        2021-05-05  2608             goto 
out_free_skb;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2609  
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2610     eosw_txq->state = 
next_state;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2611     eosw_txq->flowc_idx = 
eosw_txq->pidx;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2612     
eosw_txq_advance(eosw_txq, 1);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2613     ethofld_xmit(dev, 
eosw_txq);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2614  
52bfcdd87e83d9 Íñigo Huguet        2021-05-05  2615     
spin_unlock_bh(&eosw_txq->lock);
52bfcdd87e83d9 Íñigo Huguet        2021-05-05  2616     return 0;
52bfcdd87e83d9 Íñigo Huguet        2021-05-05  2617  
52bfcdd87e83d9 Íñigo Huguet        2021-05-05  2618  out_free_skb:
52bfcdd87e83d9 Íñigo Huguet        2021-05-05  2619     
dev_consume_skb_any(skb);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2620     
spin_unlock_bh(&eosw_txq->lock);
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2621     return ret;
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2622  }
0e395b3cb1fb82 Rahul Lakkireddy    2019-11-07  2623  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp
_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to