From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [xilinx-xlnx:xlnx_rebase_v5.15 942/1024] drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1641:17-20: ERROR: reference preceded by free on line 1618
Date: Sun, 27 Mar 2022 00:20:37 +0800 [thread overview]
Message-ID: <202203270040.MJCkyEOu-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 14545 bytes --]
CC: kbuild-all(a)lists.01.org
BCC: lkp(a)intel.com
CC: linux-arm-kernel(a)lists.infradead.org
TO: Harini Katakam <harini.katakam@xilinx.com>
CC: Michal Simek <monstr@monstr.eu>
CC: Swati Agarwal <swati.agarwal@xilinx.com>
CC: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
tree: https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15
head: aceb8dba4813e07934d2847fdaf8bdfaaf9f622c
commit: 8bb7c59151794fc747f9e9faba7a0cec067a0252 [942/1024] net: axienet: Handle dma mapping errors in RX datapath
:::::: branch date: 3 days ago
:::::: commit date: 4 weeks ago
config: ia64-randconfig-c004-20220324 (https://download.01.org/0day-ci/archive/20220327/202203270040.MJCkyEOu-lkp(a)intel.com/config)
compiler: ia64-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: Julia Lawall <julia.lawall@lip6.fr>
cocci warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/xilinx/xilinx_axienet_main.c:1641:17-20: ERROR: reference preceded by free on line 1618
vim +1641 drivers/net/ethernet/xilinx/xilinx_axienet_main.c
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1533
ee94241b2118ddd Saurabh Sengar 2021-01-22 1534 dma_unmap_single(ndev->dev.parent, cur_p->phys,
ee94241b2118ddd Saurabh Sengar 2021-01-22 1535 lp->max_frm_size,
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1536 DMA_FROM_DEVICE);
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1537
ee94241b2118ddd Saurabh Sengar 2021-01-22 1538 skb = (struct sk_buff *)(cur_p->sw_id_offset);
f6420dd2cc68a93 Appana Durga Kedareswara Rao 2020-01-24 1539
c8f87454e38ff93 Appana Durga Kedareswara Rao 2020-01-24 1540 if (lp->eth_hasnobuf ||
c8f87454e38ff93 Appana Durga Kedareswara Rao 2020-01-24 1541 lp->axienet_config->mactype != XAXIENET_1G)
f6420dd2cc68a93 Appana Durga Kedareswara Rao 2020-01-24 1542 length = cur_p->status & XAXIDMA_BD_STS_ACTUAL_LEN_MASK;
f6420dd2cc68a93 Appana Durga Kedareswara Rao 2020-01-24 1543 else
23e6b2dc93630b6 Robert Hancock 2019-06-06 1544 length = cur_p->app4 & 0x0000FFFF;
23e6b2dc93630b6 Robert Hancock 2019-06-06 1545
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1546 skb_put(skb, length);
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1547 #ifdef CONFIG_XILINX_AXI_EMAC_HWTSTAMP
a7ae7ddafe91c16 Saurabh Sengar 2021-01-22 1548 if (!lp->is_tsn) {
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1549 if ((lp->tstamp_config.rx_filter == HWTSTAMP_FILTER_ALL ||
146b2ba5b5d5e97 Harini Katakam 2021-01-22 1550 lp->eth_hasptp) &&
146b2ba5b5d5e97 Harini Katakam 2021-01-22 1551 (lp->axienet_config->mactype != XAXIENET_10G_25G) &&
146b2ba5b5d5e97 Harini Katakam 2021-01-22 1552 (lp->axienet_config->mactype != XAXIENET_MRMAC)) {
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1553 u32 sec, nsec;
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1554 u64 time64;
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1555 struct skb_shared_hwtstamps *shhwtstamps;
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1556
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1557 if (lp->axienet_config->mactype == XAXIENET_1G ||
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1558 lp->axienet_config->mactype == XAXIENET_2_5G) {
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1559 /* The first 8 bytes will be the timestamp */
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1560 memcpy(&sec, &skb->data[0], 4);
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1561 memcpy(&nsec, &skb->data[4], 4);
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1562
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1563 sec = cpu_to_be32(sec);
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1564 nsec = cpu_to_be32(nsec);
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1565 } else {
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1566 /* The first 8 bytes will be the timestamp */
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1567 memcpy(&nsec, &skb->data[0], 4);
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1568 memcpy(&sec, &skb->data[4], 4);
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1569 }
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1570
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1571 /* Remove these 8 bytes from the buffer */
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1572 skb_pull(skb, 8);
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1573 time64 = sec * NS_PER_SEC + nsec;
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1574 shhwtstamps = skb_hwtstamps(skb);
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1575 shhwtstamps->hwtstamp = ns_to_ktime(time64);
e74bff7aa33454c Harini Katakam 2021-01-22 1576 } else if (lp->axienet_config->mactype == XAXIENET_10G_25G ||
e74bff7aa33454c Harini Katakam 2021-01-22 1577 lp->axienet_config->mactype == XAXIENET_MRMAC) {
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1578 axienet_rx_hwtstamp(lp, skb);
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1579 }
a7ae7ddafe91c16 Saurabh Sengar 2021-01-22 1580 }
bf05571deda79b6 Appana Durga Kedareswara Rao 2020-01-24 1581 #endif
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1582 skb->protocol = eth_type_trans(skb, ndev);
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1583 /*skb_checksum_none_assert(skb);*/
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1584 skb->ip_summed = CHECKSUM_NONE;
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1585
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1586 /* if we're doing Rx csum offload, set it up */
f6420dd2cc68a93 Appana Durga Kedareswara Rao 2020-01-24 1587 if (lp->features & XAE_FEATURE_FULL_RX_CSUM &&
c8f87454e38ff93 Appana Durga Kedareswara Rao 2020-01-24 1588 (lp->axienet_config->mactype == XAXIENET_1G) &&
f6420dd2cc68a93 Appana Durga Kedareswara Rao 2020-01-24 1589 !lp->eth_hasnobuf) {
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1590 csumstatus = (cur_p->app2 &
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1591 XAE_FULL_CSUM_STATUS_MASK) >> 3;
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1592 if ((csumstatus == XAE_IP_TCP_CSUM_VALIDATED) ||
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1593 (csumstatus == XAE_IP_UDP_CSUM_VALIDATED)) {
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1594 skb->ip_summed = CHECKSUM_UNNECESSARY;
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1595 }
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1596 } else if ((lp->features & XAE_FEATURE_PARTIAL_RX_CSUM) != 0 &&
ceffc4acfc8c4cf Joe Perches 2014-03-12 1597 skb->protocol == htons(ETH_P_IP) &&
c8f87454e38ff93 Appana Durga Kedareswara Rao 2020-01-24 1598 skb->len > 64 && !lp->eth_hasnobuf &&
c8f87454e38ff93 Appana Durga Kedareswara Rao 2020-01-24 1599 (lp->axienet_config->mactype == XAXIENET_1G)) {
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1600 skb->csum = be32_to_cpu(cur_p->app3 & 0xFFFF);
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1601 skb->ip_summed = CHECKSUM_COMPLETE;
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1602 }
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1603 #ifdef CONFIG_XILINX_TSN
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1604 if (unlikely(q->flags & MCDMA_MGMT_CHAN)) {
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1605 struct net_device *ndev = NULL;
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1606
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1607 /* received packet on mgmt channel */
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1608 if (q->flags & MCDMA_MGMT_CHAN_PORT0)
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1609 ndev = lp->slaves[0];
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1610 else if (q->flags & MCDMA_MGMT_CHAN_PORT1)
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1611 ndev = lp->slaves[1];
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1612
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1613 /* send to one of the front panel port */
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1614 if (ndev && netif_running(ndev)) {
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1615 skb->dev = ndev;
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1616 netif_receive_skb(skb);
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1617 } else {
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 @1618 kfree(skb); /* dont send up the stack */
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1619 }
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1620 } else {
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1621 netif_receive_skb(skb); /* send on normal data path */
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1622 }
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1623 #else
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1624
ec9a60a97272571 Appana Durga Kedareswara Rao 2020-01-24 1625 netif_receive_skb(skb);
65f1c62ef6567bb Pranavi Somisetty 2021-01-22 1626 #endif
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1627
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1628 size += length;
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1629 packets++;
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1630
244a92b6cc6f9ae Appana Durga Kedareswara Rao 2020-01-24 1631 /* Ensure that the skb is completely updated
244a92b6cc6f9ae Appana Durga Kedareswara Rao 2020-01-24 1632 * prio to mapping the DMA
244a92b6cc6f9ae Appana Durga Kedareswara Rao 2020-01-24 1633 */
244a92b6cc6f9ae Appana Durga Kedareswara Rao 2020-01-24 1634 wmb();
244a92b6cc6f9ae Appana Durga Kedareswara Rao 2020-01-24 1635
ee94241b2118ddd Saurabh Sengar 2021-01-22 1636 cur_p->phys = dma_map_single(ndev->dev.parent, new_skb->data,
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1637 lp->max_frm_size,
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1638 DMA_FROM_DEVICE);
8bb7c59151794fc Harini Katakam 2022-02-22 1639 if (unlikely(dma_mapping_error(ndev->dev.parent, cur_p->phys))) {
8bb7c59151794fc Harini Katakam 2022-02-22 1640 cur_p->phys = 0;
8bb7c59151794fc Harini Katakam 2022-02-22 @1641 dev_kfree_skb(skb);
8bb7c59151794fc Harini Katakam 2022-02-22 1642 dev_err(lp->dev, "RX buffer map failed\n");
8bb7c59151794fc Harini Katakam 2022-02-22 1643 break;
8bb7c59151794fc Harini Katakam 2022-02-22 1644 }
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1645 cur_p->cntrl = lp->max_frm_size;
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1646 cur_p->status = 0;
ee94241b2118ddd Saurabh Sengar 2021-01-22 1647 cur_p->sw_id_offset = (phys_addr_t)new_skb;
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1648
ee94241b2118ddd Saurabh Sengar 2021-01-22 1649 if (++q->rx_bd_ci >= lp->rx_bd_num)
ee94241b2118ddd Saurabh Sengar 2021-01-22 1650 q->rx_bd_ci = 0;
244a92b6cc6f9ae Appana Durga Kedareswara Rao 2020-01-24 1651
244a92b6cc6f9ae Appana Durga Kedareswara Rao 2020-01-24 1652 /* Get relevat BD status value */
244a92b6cc6f9ae Appana Durga Kedareswara Rao 2020-01-24 1653 rmb();
ee94241b2118ddd Saurabh Sengar 2021-01-22 1654 #ifdef CONFIG_AXIENET_HAS_MCDMA
ee94241b2118ddd Saurabh Sengar 2021-01-22 1655 cur_p = &q->rxq_bd_v[q->rx_bd_ci];
ee94241b2118ddd Saurabh Sengar 2021-01-22 1656 #else
ee94241b2118ddd Saurabh Sengar 2021-01-22 1657 cur_p = &q->rx_bd_v[q->rx_bd_ci];
ee94241b2118ddd Saurabh Sengar 2021-01-22 1658 #endif
ec9a60a97272571 Appana Durga Kedareswara Rao 2020-01-24 1659 numbdfree++;
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1660 }
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1661
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1662 ndev->stats.rx_packets += packets;
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1663 ndev->stats.rx_bytes += size;
ee94241b2118ddd Saurabh Sengar 2021-01-22 1664 q->rx_packets += packets;
ee94241b2118ddd Saurabh Sengar 2021-01-22 1665 q->rx_bytes += size;
8a3b7a252dca9fb Daniel Borkmann 2012-01-19 1666
ee94241b2118ddd Saurabh Sengar 2021-01-22 1667 if (tail_p) {
ee94241b2118ddd Saurabh Sengar 2021-01-22 1668 #ifdef CONFIG_AXIENET_HAS_MCDMA
ee94241b2118ddd Saurabh Sengar 2021-01-22 1669 axienet_dma_bdout(q, XMCDMA_CHAN_TAILDESC_OFFSET(q->chan_id) +
ee94241b2118ddd Saurabh Sengar 2021-01-22 1670 q->rx_offset, tail_p);
ee94241b2118ddd Saurabh Sengar 2021-01-22 1671 #else
ee94241b2118ddd Saurabh Sengar 2021-01-22 1672 axienet_dma_bdout(q, XAXIDMA_RX_TDESC_OFFSET, tail_p);
ee94241b2118ddd Saurabh Sengar 2021-01-22 1673 #endif
ee94241b2118ddd Saurabh Sengar 2021-01-22 1674 }
ec9a60a97272571 Appana Durga Kedareswara Rao 2020-01-24 1675
ec9a60a97272571 Appana Durga Kedareswara Rao 2020-01-24 1676 return numbdfree;
ec9a60a97272571 Appana Durga Kedareswara Rao 2020-01-24 1677 }
ec9a60a97272571 Appana Durga Kedareswara Rao 2020-01-24 1678
--
0-DAY CI Kernel Test Service
https://01.org/lkp
reply other threads:[~2022-03-26 16:20 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=202203270040.MJCkyEOu-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/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.