From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Oliver Hartkopp <socketcan@hartkopp.net>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
linux-can@vger.kernel.org, Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [mkl-can-next:testing 4/29] drivers/net/can/vxcan.c:60 vxcan_xmit() error: use kfree_skb() here instead of kfree(oskb)
Date: Fri, 11 Mar 2022 14:16:25 +0300 [thread overview]
Message-ID: <202203110433.qIHMpuS5-lkp@intel.com> (raw)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git testing
head: 0691a4b55c89055c1efb61a7696f4bc6aa5cf630
commit: 1574481bb3de11c9d44f5405c17e948b76794f39 [4/29] vxcan: remove sk reference in peer skb
config: arc-randconfig-m031-20220310 (https://download.01.org/0day-ci/archive/20220311/202203110433.qIHMpuS5-lkp@intel.com/config)
compiler: arceb-elf-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/can/vxcan.c:60 vxcan_xmit() error: use kfree_skb() here instead of kfree(oskb)
vim +60 drivers/net/can/vxcan.c
1574481bb3de11 Oliver Hartkopp 2022-03-09 36 static netdev_tx_t vxcan_xmit(struct sk_buff *oskb, struct net_device *dev)
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 37 {
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 38 struct vxcan_priv *priv = netdev_priv(dev);
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 39 struct net_device *peer;
1574481bb3de11 Oliver Hartkopp 2022-03-09 40 struct canfd_frame *cfd = (struct canfd_frame *)oskb->data;
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 41 struct net_device_stats *peerstats, *srcstats = &dev->stats;
1574481bb3de11 Oliver Hartkopp 2022-03-09 42 struct sk_buff *skb;
75854cad5d8097 Vincent Mailhol 2021-01-20 43 u8 len;
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 44
1574481bb3de11 Oliver Hartkopp 2022-03-09 45 if (can_dropped_invalid_skb(dev, oskb))
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 46 return NETDEV_TX_OK;
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 47
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 48 rcu_read_lock();
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 49 peer = rcu_dereference(priv->peer);
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 50 if (unlikely(!peer)) {
1574481bb3de11 Oliver Hartkopp 2022-03-09 51 kfree_skb(oskb);
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 52 dev->stats.tx_dropped++;
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 53 goto out_unlock;
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 54 }
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 55
1574481bb3de11 Oliver Hartkopp 2022-03-09 56 skb = skb_clone(oskb, GFP_ATOMIC);
1574481bb3de11 Oliver Hartkopp 2022-03-09 57 if (skb) {
1574481bb3de11 Oliver Hartkopp 2022-03-09 58 consume_skb(oskb);
1574481bb3de11 Oliver Hartkopp 2022-03-09 59 } else {
1574481bb3de11 Oliver Hartkopp 2022-03-09 @60 kfree(oskb);
kfree_skb(oskb);
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 61 goto out_unlock;
1574481bb3de11 Oliver Hartkopp 2022-03-09 62 }
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 63
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 64 /* reset CAN GW hop counter */
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 65 skb->csum_start = 0;
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 66 skb->pkt_type = PACKET_BROADCAST;
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 67 skb->dev = peer;
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 68 skb->ip_summed = CHECKSUM_UNNECESSARY;
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 69
cc4b08c31b5c51 Vincent Mailhol 2021-12-07 70 len = cfd->can_id & CAN_RTR_FLAG ? 0 : cfd->len;
00f4a0afb7eafd Sebastian Andrzej Siewior 2022-03-05 71 if (netif_rx(skb) == NET_RX_SUCCESS) {
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 72 srcstats->tx_packets++;
75854cad5d8097 Vincent Mailhol 2021-01-20 73 srcstats->tx_bytes += len;
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 74 peerstats = &peer->stats;
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 75 peerstats->rx_packets++;
75854cad5d8097 Vincent Mailhol 2021-01-20 76 peerstats->rx_bytes += len;
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 77 }
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 78
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 79 out_unlock:
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 80 rcu_read_unlock();
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 81 return NETDEV_TX_OK;
a8f820a380a2a0 Oliver Hartkopp 2017-04-25 82 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
next reply other threads:[~2022-03-11 11:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-11 11:16 Dan Carpenter [this message]
2022-03-11 12:49 ` [mkl-can-next:testing 4/29] drivers/net/can/vxcan.c:60 vxcan_xmit() error: use kfree_skb() here instead of kfree(oskb) Marc Kleine-Budde
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=202203110433.qIHMpuS5-lkp@intel.com \
--to=dan.carpenter@oracle.com \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=linux-can@vger.kernel.org \
--cc=lkp@intel.com \
--cc=mkl@pengutronix.de \
--cc=socketcan@hartkopp.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox