All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Pavel Skripkin <paskripkin@gmail.com>,
	wg@grandegger.com, mkl@pengutronix.de, davem@davemloft.net,
	socketcan@hartkopp.net, mailhol.vincent@wanadoo.fr,
	Stefan.Maetje@esd.eu, matthias.fuchs@esd.eu
Cc: kbuild-all@lists.01.org, linux-can@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] can: esd_usb2: fix memory leak
Date: Tue, 27 Jul 2021 03:51:38 +0800	[thread overview]
Message-ID: <202107270334.Q6YUKYBt-lkp@intel.com> (raw)
In-Reply-To: <a6ccf6adbcfeaad8c4ed24e94c50b2dd3db57c15.1627311383.git.paskripkin@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4243 bytes --]

Hi Pavel,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mkl-can-next/testing]
[also build test ERROR on v5.14-rc3 next-20210723]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Pavel-Skripkin/can-fix-same-memory-leaks-in-can-drivers/20210726-233224
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git testing
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/14373e3834eb74f943720146607c709613b93e95
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Pavel-Skripkin/can-fix-same-memory-leaks-in-can-drivers/20210726-233224
        git checkout 14373e3834eb74f943720146607c709613b93e95
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=sh SHELL=/bin/bash drivers/net/can/usb/

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

All errors (new ones prefixed by >>):

   drivers/net/can/usb/esd_usb2.c: In function 'esd_usb2_setup_rx_urbs':
>> drivers/net/can/usb/esd_usb2.c:582:4: error: label 'freeusrb' used but not defined
     582 |    goto freeusrb;
         |    ^~~~

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for SND_ATMEL_SOC_PDC
   Depends on SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && HAS_DMA
   Selected by
   - SND_ATMEL_SOC_SSC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC
   - SND_ATMEL_SOC_SSC_PDC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && ATMEL_SSC


vim +/freeusrb +582 drivers/net/can/usb/esd_usb2.c

   539	
   540	static int esd_usb2_setup_rx_urbs(struct esd_usb2 *dev)
   541	{
   542		int i, err = 0;
   543	
   544		if (dev->rxinitdone)
   545			return 0;
   546	
   547		for (i = 0; i < MAX_RX_URBS; i++) {
   548			struct urb *urb = NULL;
   549			u8 *buf = NULL;
   550			dma_addr_t buf_dma;
   551	
   552			/* create a URB, and a buffer for it */
   553			urb = usb_alloc_urb(0, GFP_KERNEL);
   554			if (!urb) {
   555				err = -ENOMEM;
   556				break;
   557			}
   558	
   559			buf = usb_alloc_coherent(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL,
   560						 &buf_dma);
   561			if (!buf) {
   562				dev_warn(dev->udev->dev.parent,
   563					 "No memory left for USB buffer\n");
   564				err = -ENOMEM;
   565				goto freeurb;
   566			}
   567	
   568			urb->transfer_dma = buf_dma;
   569	
   570			usb_fill_bulk_urb(urb, dev->udev,
   571					  usb_rcvbulkpipe(dev->udev, 1),
   572					  buf, RX_BUFFER_SIZE,
   573					  esd_usb2_read_bulk_callback, dev);
   574			urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
   575			usb_anchor_urb(urb, &dev->rx_submitted);
   576	
   577			err = usb_submit_urb(urb, GFP_KERNEL);
   578			if (err) {
   579				usb_unanchor_urb(urb);
   580				usb_free_coherent(dev->udev, RX_BUFFER_SIZE, buf,
   581						  urb->transfer_dma);
 > 582				goto freeusrb;
   583			}
   584	
   585			dev->rxbuf[i] = buf;
   586			dev->rxbuf_dma[i] = buf_dma;
   587	
   588	freeurb:
   589			/* Drop reference, USB core will take care of freeing it */
   590			usb_free_urb(urb);
   591			if (err)
   592				break;
   593		}
   594	
   595		/* Did we submit any URBs */
   596		if (i == 0) {
   597			dev_err(dev->udev->dev.parent, "couldn't setup read URBs\n");
   598			return err;
   599		}
   600	
   601		/* Warn if we've couldn't transmit all the URBs */
   602		if (i < MAX_RX_URBS) {
   603			dev_warn(dev->udev->dev.parent,
   604				 "rx performance may be slow\n");
   605		}
   606	
   607		dev->rxinitdone = 1;
   608		return 0;
   609	}
   610	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 55013 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH 3/3] can: esd_usb2: fix memory leak
Date: Tue, 27 Jul 2021 03:51:38 +0800	[thread overview]
Message-ID: <202107270334.Q6YUKYBt-lkp@intel.com> (raw)
In-Reply-To: <a6ccf6adbcfeaad8c4ed24e94c50b2dd3db57c15.1627311383.git.paskripkin@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4366 bytes --]

Hi Pavel,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on mkl-can-next/testing]
[also build test ERROR on v5.14-rc3 next-20210723]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Pavel-Skripkin/can-fix-same-memory-leaks-in-can-drivers/20210726-233224
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next.git testing
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gcc (GCC) 10.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/14373e3834eb74f943720146607c709613b93e95
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Pavel-Skripkin/can-fix-same-memory-leaks-in-can-drivers/20210726-233224
        git checkout 14373e3834eb74f943720146607c709613b93e95
        # save the attached .config to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross O=build_dir ARCH=sh SHELL=/bin/bash drivers/net/can/usb/

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

All errors (new ones prefixed by >>):

   drivers/net/can/usb/esd_usb2.c: In function 'esd_usb2_setup_rx_urbs':
>> drivers/net/can/usb/esd_usb2.c:582:4: error: label 'freeusrb' used but not defined
     582 |    goto freeusrb;
         |    ^~~~

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for SND_ATMEL_SOC_PDC
   Depends on SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && HAS_DMA
   Selected by
   - SND_ATMEL_SOC_SSC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC
   - SND_ATMEL_SOC_SSC_PDC && SOUND && !UML && SND && SND_SOC && SND_ATMEL_SOC && ATMEL_SSC


vim +/freeusrb +582 drivers/net/can/usb/esd_usb2.c

   539	
   540	static int esd_usb2_setup_rx_urbs(struct esd_usb2 *dev)
   541	{
   542		int i, err = 0;
   543	
   544		if (dev->rxinitdone)
   545			return 0;
   546	
   547		for (i = 0; i < MAX_RX_URBS; i++) {
   548			struct urb *urb = NULL;
   549			u8 *buf = NULL;
   550			dma_addr_t buf_dma;
   551	
   552			/* create a URB, and a buffer for it */
   553			urb = usb_alloc_urb(0, GFP_KERNEL);
   554			if (!urb) {
   555				err = -ENOMEM;
   556				break;
   557			}
   558	
   559			buf = usb_alloc_coherent(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL,
   560						 &buf_dma);
   561			if (!buf) {
   562				dev_warn(dev->udev->dev.parent,
   563					 "No memory left for USB buffer\n");
   564				err = -ENOMEM;
   565				goto freeurb;
   566			}
   567	
   568			urb->transfer_dma = buf_dma;
   569	
   570			usb_fill_bulk_urb(urb, dev->udev,
   571					  usb_rcvbulkpipe(dev->udev, 1),
   572					  buf, RX_BUFFER_SIZE,
   573					  esd_usb2_read_bulk_callback, dev);
   574			urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
   575			usb_anchor_urb(urb, &dev->rx_submitted);
   576	
   577			err = usb_submit_urb(urb, GFP_KERNEL);
   578			if (err) {
   579				usb_unanchor_urb(urb);
   580				usb_free_coherent(dev->udev, RX_BUFFER_SIZE, buf,
   581						  urb->transfer_dma);
 > 582				goto freeusrb;
   583			}
   584	
   585			dev->rxbuf[i] = buf;
   586			dev->rxbuf_dma[i] = buf_dma;
   587	
   588	freeurb:
   589			/* Drop reference, USB core will take care of freeing it */
   590			usb_free_urb(urb);
   591			if (err)
   592				break;
   593		}
   594	
   595		/* Did we submit any URBs */
   596		if (i == 0) {
   597			dev_err(dev->udev->dev.parent, "couldn't setup read URBs\n");
   598			return err;
   599		}
   600	
   601		/* Warn if we've couldn't transmit all the URBs */
   602		if (i < MAX_RX_URBS) {
   603			dev_warn(dev->udev->dev.parent,
   604				 "rx performance may be slow\n");
   605		}
   606	
   607		dev->rxinitdone = 1;
   608		return 0;
   609	}
   610	

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 55013 bytes --]

  reply	other threads:[~2021-07-26 19:52 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-26 15:29 [PATCH 0/3] can: fix same memory leaks in can drivers Pavel Skripkin
2021-07-26 15:30 ` [PATCH 1/3] can: usb_8dev: fix memory leak Pavel Skripkin
2021-07-26 15:30 ` [PATCH 2/3] can: ems_usb: " Pavel Skripkin
2021-07-26 15:31 ` [PATCH 3/3] can: esd_usb2: " Pavel Skripkin
2021-07-26 19:51   ` kernel test robot [this message]
2021-07-26 19:51     ` kernel test robot
2021-07-28 20:38   ` kernel test robot
2021-07-28 20:38     ` kernel test robot
2021-07-26 17:29 ` [PATCH 0/3] can: fix same memory leaks in can drivers Pavel Skripkin
2021-07-26 20:02   ` Marc Kleine-Budde
2021-07-27 16:59 ` [PATCH v2 " Pavel Skripkin
2021-07-27 16:59   ` [PATCH v2 1/3] can: usb_8dev: fix memory leak Pavel Skripkin
2021-07-27 17:00   ` [PATCH v2 2/3] can: ems_usb: " Pavel Skripkin
2021-07-27 17:00   ` [PATCH v2 3/3] can: esd_usb2: " Pavel Skripkin
2021-07-28  7:56   ` [PATCH v2 0/3] can: fix same memory leaks in can drivers 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=202107270334.Q6YUKYBt-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=Stefan.Maetje@esd.eu \
    --cc=davem@davemloft.net \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=matthias.fuchs@esd.eu \
    --cc=mkl@pengutronix.de \
    --cc=netdev@vger.kernel.org \
    --cc=paskripkin@gmail.com \
    --cc=socketcan@hartkopp.net \
    --cc=wg@grandegger.com \
    /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.