From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: drivers/net/wwan/t7xx/t7xx_hif_dpmaif_tx.c:127 t7xx_dpmaif_release_tx_buffer() error: potentially dereferencing uninitialized 'cur_drb'.
Date: Thu, 30 Mar 2023 05:43:33 +0800 [thread overview]
Message-ID: <202303300555.ucDb9eoG-lkp@intel.com> (raw)
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-kernel@vger.kernel.org
TO: Haijun Liu <haijun.liu@mediatek.com>
CC: Chandrashekar Devegowda <chandrashekar.devegowda@intel.com>
CC: Ricardo Martinez <ricardo.martinez@linux.intel.com>
CC: Loic Poulain <loic.poulain@linaro.org>
CC: Sergey Ryazanov <ryazanov.s.a@gmail.com>
CC: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: ffe78bbd512166e0ef1cc4858010b128c510ed7d
commit: d642b012df70a76dd5723f2d426b40bffe83ac49 net: wwan: t7xx: Add data path interface
date: 11 months ago
:::::: branch date: 4 hours ago
:::::: commit date: 11 months ago
config: arm64-randconfig-m041-20230329 (https://download.01.org/0day-ci/archive/20230330/202303300555.ucDb9eoG-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Link: https://lore.kernel.org/r/202303300555.ucDb9eoG-lkp@intel.com/
smatch warnings:
drivers/net/wwan/t7xx/t7xx_hif_dpmaif_tx.c:127 t7xx_dpmaif_release_tx_buffer() error: potentially dereferencing uninitialized 'cur_drb'.
vim +/cur_drb +127 drivers/net/wwan/t7xx/t7xx_hif_dpmaif_tx.c
d642b012df70a7 Haijun Liu 2022-05-06 78
d642b012df70a7 Haijun Liu 2022-05-06 79 static unsigned int t7xx_dpmaif_release_tx_buffer(struct dpmaif_ctrl *dpmaif_ctrl,
d642b012df70a7 Haijun Liu 2022-05-06 80 unsigned int q_num, unsigned int release_cnt)
d642b012df70a7 Haijun Liu 2022-05-06 81 {
d642b012df70a7 Haijun Liu 2022-05-06 82 struct dpmaif_tx_queue *txq = &dpmaif_ctrl->txq[q_num];
d642b012df70a7 Haijun Liu 2022-05-06 83 struct dpmaif_callbacks *cb = dpmaif_ctrl->callbacks;
d642b012df70a7 Haijun Liu 2022-05-06 84 struct dpmaif_drb_skb *cur_drb_skb, *drb_skb_base;
d642b012df70a7 Haijun Liu 2022-05-06 85 struct dpmaif_drb *cur_drb, *drb_base;
d642b012df70a7 Haijun Liu 2022-05-06 86 unsigned int drb_cnt, i, cur_idx;
d642b012df70a7 Haijun Liu 2022-05-06 87 unsigned long flags;
d642b012df70a7 Haijun Liu 2022-05-06 88
d642b012df70a7 Haijun Liu 2022-05-06 89 drb_skb_base = txq->drb_skb_base;
d642b012df70a7 Haijun Liu 2022-05-06 90 drb_base = txq->drb_base;
d642b012df70a7 Haijun Liu 2022-05-06 91
d642b012df70a7 Haijun Liu 2022-05-06 92 spin_lock_irqsave(&txq->tx_lock, flags);
d642b012df70a7 Haijun Liu 2022-05-06 93 drb_cnt = txq->drb_size_cnt;
d642b012df70a7 Haijun Liu 2022-05-06 94 cur_idx = txq->drb_release_rd_idx;
d642b012df70a7 Haijun Liu 2022-05-06 95 spin_unlock_irqrestore(&txq->tx_lock, flags);
d642b012df70a7 Haijun Liu 2022-05-06 96
d642b012df70a7 Haijun Liu 2022-05-06 97 for (i = 0; i < release_cnt; i++) {
d642b012df70a7 Haijun Liu 2022-05-06 98 cur_drb = drb_base + cur_idx;
d642b012df70a7 Haijun Liu 2022-05-06 99 if (FIELD_GET(DRB_HDR_DTYP, le32_to_cpu(cur_drb->header)) == DES_DTYP_PD) {
d642b012df70a7 Haijun Liu 2022-05-06 100 cur_drb_skb = drb_skb_base + cur_idx;
d642b012df70a7 Haijun Liu 2022-05-06 101 if (!cur_drb_skb->is_msg)
d642b012df70a7 Haijun Liu 2022-05-06 102 dma_unmap_single(dpmaif_ctrl->dev, cur_drb_skb->bus_addr,
d642b012df70a7 Haijun Liu 2022-05-06 103 cur_drb_skb->data_len, DMA_TO_DEVICE);
d642b012df70a7 Haijun Liu 2022-05-06 104
d642b012df70a7 Haijun Liu 2022-05-06 105 if (!FIELD_GET(DRB_HDR_CONT, le32_to_cpu(cur_drb->header))) {
d642b012df70a7 Haijun Liu 2022-05-06 106 if (!cur_drb_skb->skb) {
d642b012df70a7 Haijun Liu 2022-05-06 107 dev_err(dpmaif_ctrl->dev,
d642b012df70a7 Haijun Liu 2022-05-06 108 "txq%u: DRB check fail, invalid skb\n", q_num);
d642b012df70a7 Haijun Liu 2022-05-06 109 continue;
d642b012df70a7 Haijun Liu 2022-05-06 110 }
d642b012df70a7 Haijun Liu 2022-05-06 111
d642b012df70a7 Haijun Liu 2022-05-06 112 dev_kfree_skb_any(cur_drb_skb->skb);
d642b012df70a7 Haijun Liu 2022-05-06 113 }
d642b012df70a7 Haijun Liu 2022-05-06 114
d642b012df70a7 Haijun Liu 2022-05-06 115 cur_drb_skb->skb = NULL;
d642b012df70a7 Haijun Liu 2022-05-06 116 }
d642b012df70a7 Haijun Liu 2022-05-06 117
d642b012df70a7 Haijun Liu 2022-05-06 118 spin_lock_irqsave(&txq->tx_lock, flags);
d642b012df70a7 Haijun Liu 2022-05-06 119 cur_idx = t7xx_ring_buf_get_next_wr_idx(drb_cnt, cur_idx);
d642b012df70a7 Haijun Liu 2022-05-06 120 txq->drb_release_rd_idx = cur_idx;
d642b012df70a7 Haijun Liu 2022-05-06 121 spin_unlock_irqrestore(&txq->tx_lock, flags);
d642b012df70a7 Haijun Liu 2022-05-06 122
d642b012df70a7 Haijun Liu 2022-05-06 123 if (atomic_inc_return(&txq->tx_budget) > txq->drb_size_cnt / 8)
d642b012df70a7 Haijun Liu 2022-05-06 124 cb->state_notify(dpmaif_ctrl->t7xx_dev, DMPAIF_TXQ_STATE_IRQ, txq->index);
d642b012df70a7 Haijun Liu 2022-05-06 125 }
d642b012df70a7 Haijun Liu 2022-05-06 126
d642b012df70a7 Haijun Liu 2022-05-06 @127 if (FIELD_GET(DRB_HDR_CONT, le32_to_cpu(cur_drb->header)))
d642b012df70a7 Haijun Liu 2022-05-06 128 dev_err(dpmaif_ctrl->dev, "txq%u: DRB not marked as the last one\n", q_num);
d642b012df70a7 Haijun Liu 2022-05-06 129
d642b012df70a7 Haijun Liu 2022-05-06 130 return i;
d642b012df70a7 Haijun Liu 2022-05-06 131 }
d642b012df70a7 Haijun Liu 2022-05-06 132
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
next reply other threads:[~2023-03-29 21:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-29 21:43 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-03-04 1:53 drivers/net/wwan/t7xx/t7xx_hif_dpmaif_tx.c:127 t7xx_dpmaif_release_tx_buffer() error: potentially dereferencing uninitialized 'cur_drb' kernel test robot
2022-09-21 11:52 kernel test robot
2022-09-19 22:10 kernel test robot
2022-08-15 0:30 kernel test robot
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=202303300555.ucDb9eoG-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/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.