All of lore.kernel.org
 help / color / mirror / Atom feed
* drivers/media/platform/omap3isp/isphist.c:526 omap3isp_hist_init() warn: possible memory leak of 'hist_cfg'
@ 2021-01-26 11:45 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-01-26 11:45 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Arnd Bergmann <arnd@arndb.de>
CC: Herbert Xu <herbert@gondor.apana.org.au>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   13391c60da3308ed9980de0168f74cce6c62ac1d
commit: eebac678556d6927f09a992872f4464cf3aecc76 crypto: ccp -- don't "select" CONFIG_DMADEVICES
date:   10 months ago
:::::: branch date: 12 hours ago
:::::: commit date: 10 months ago
config: arm64-randconfig-m031-20210126 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.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>

smatch warnings:
drivers/media/platform/omap3isp/isphist.c:526 omap3isp_hist_init() warn: possible memory leak of 'hist_cfg'

vim +/hist_cfg +526 drivers/media/platform/omap3isp/isphist.c

68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  470  
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  471  /*
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  472   * omap3isp_hist_init - Module Initialization.
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  473   */
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  474  int omap3isp_hist_init(struct isp_device *isp)
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  475  {
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  476  	struct ispstat *hist = &isp->isp_hist;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  477  	struct omap3isp_hist_config *hist_cfg;
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  478  	int ret;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  479  
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  480  	hist_cfg = kzalloc(sizeof(*hist_cfg), GFP_KERNEL);
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  481  	if (hist_cfg == NULL)
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  482  		return -ENOMEM;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  483  
d83501a0416160 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2012-10-11  484  	hist->isp = isp;
d83501a0416160 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2012-10-11  485  
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  486  	if (HIST_CONFIG_DMA) {
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  487  		dma_cap_mask_t mask;
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  488  
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  489  		/*
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  490  		 * We need slave capable channel without DMA request line for
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  491  		 * reading out the data.
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  492  		 * For this we can use dma_request_chan_by_mask() as we are
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  493  		 * happy with any channel as long as it is capable of slave
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  494  		 * configuration.
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  495  		 */
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  496  		dma_cap_zero(mask);
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  497  		dma_cap_set(DMA_SLAVE, mask);
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  498  		hist->dma_ch = dma_request_chan_by_mask(&mask);
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  499  		if (IS_ERR(hist->dma_ch)) {
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  500  			ret = PTR_ERR(hist->dma_ch);
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  501  			if (ret == -EPROBE_DEFER)
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  502  				goto err;
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  503  
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  504  			hist->dma_ch = NULL;
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  505  			dev_warn(isp->dev,
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  506  				 "hist: DMA channel request failed, using PIO\n");
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  507  		} else {
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  508  			dev_dbg(isp->dev, "hist: using DMA channel %s\n",
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  509  				dma_chan_name(hist->dma_ch));
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  510  		}
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  511  	}
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  512  
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  513  	hist->ops = &hist_ops;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  514  	hist->priv = hist_cfg;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  515  	hist->event_type = V4L2_EVENT_OMAP3ISP_HIST;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  516  
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  517  	ret = omap3isp_stat_init(hist, "histogram", &hist_subdev_ops);
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  518  
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  519  err:
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  520  	if (ret) {
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  521  		if (!IS_ERR_OR_NULL(hist->dma_ch))
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  522  			dma_release_channel(hist->dma_ch);
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  523  		kfree(hist_cfg);
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  524  	}
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  525  
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12 @526  	return ret;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  527  }
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  528  

:::::: The code at line 526 was first introduced by commit
:::::: 68e342b3068cae62f3378cb4a1d385734ea52784 [media] omap3isp: Statistics

:::::: TO: David Cohen <dacohen@gmail.com>
:::::: CC: Mauro Carvalho Chehab <mchehab@redhat.com>

---
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: 28486 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* drivers/media/platform/omap3isp/isphist.c:526 omap3isp_hist_init() warn: possible memory leak of 'hist_cfg'
@ 2021-03-26 12:29 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2021-03-26 12:29 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
CC: linux-kernel(a)vger.kernel.org
TO: Mauro Carvalho Chehab <mchehab@kernel.org>
CC: linux-media(a)vger.kernel.org

Hi Mauro,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   db24726bfefa68c606947a86132591568a06bfb4
commit: a19f228b8dd9a67e8de4ebd4eac8a4c94ec39d1a media: Kconfig: not all V4L2 platform drivers are for camera
date:   12 months ago
:::::: branch date: 13 hours ago
:::::: commit date: 12 months ago
config: h8300-randconfig-m031-20210326 (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.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>

smatch warnings:
drivers/media/platform/omap3isp/isphist.c:526 omap3isp_hist_init() warn: possible memory leak of 'hist_cfg'

vim +/hist_cfg +526 drivers/media/platform/omap3isp/isphist.c

68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  470  
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  471  /*
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  472   * omap3isp_hist_init - Module Initialization.
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  473   */
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  474  int omap3isp_hist_init(struct isp_device *isp)
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  475  {
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  476  	struct ispstat *hist = &isp->isp_hist;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  477  	struct omap3isp_hist_config *hist_cfg;
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  478  	int ret;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  479  
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  480  	hist_cfg = kzalloc(sizeof(*hist_cfg), GFP_KERNEL);
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  481  	if (hist_cfg == NULL)
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  482  		return -ENOMEM;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  483  
d83501a0416160 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2012-10-11  484  	hist->isp = isp;
d83501a0416160 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2012-10-11  485  
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  486  	if (HIST_CONFIG_DMA) {
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  487  		dma_cap_mask_t mask;
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  488  
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  489  		/*
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  490  		 * We need slave capable channel without DMA request line for
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  491  		 * reading out the data.
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  492  		 * For this we can use dma_request_chan_by_mask() as we are
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  493  		 * happy with any channel as long as it is capable of slave
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  494  		 * configuration.
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  495  		 */
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  496  		dma_cap_zero(mask);
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  497  		dma_cap_set(DMA_SLAVE, mask);
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  498  		hist->dma_ch = dma_request_chan_by_mask(&mask);
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  499  		if (IS_ERR(hist->dma_ch)) {
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  500  			ret = PTR_ERR(hist->dma_ch);
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  501  			if (ret == -EPROBE_DEFER)
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  502  				goto err;
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  503  
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  504  			hist->dma_ch = NULL;
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  505  			dev_warn(isp->dev,
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  506  				 "hist: DMA channel request failed, using PIO\n");
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  507  		} else {
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  508  			dev_dbg(isp->dev, "hist: using DMA channel %s\n",
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  509  				dma_chan_name(hist->dma_ch));
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  510  		}
a9943f6b6b77cf drivers/media/platform/omap3isp/isphist.c Peter Ujfalusi   2016-11-04  511  	}
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  512  
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  513  	hist->ops = &hist_ops;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  514  	hist->priv = hist_cfg;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  515  	hist->event_type = V4L2_EVENT_OMAP3ISP_HIST;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  516  
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  517  	ret = omap3isp_stat_init(hist, "histogram", &hist_subdev_ops);
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  518  
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  519  err:
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  520  	if (ret) {
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  521  		if (!IS_ERR_OR_NULL(hist->dma_ch))
0ff4e419dc6a40 drivers/media/platform/omap3isp/isphist.c Laurent Pinchart 2015-02-21  522  			dma_release_channel(hist->dma_ch);
814434984a5d20 drivers/media/platform/omap3isp/isphist.c Sakari Ailus     2017-07-13  523  		kfree(hist_cfg);
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  524  	}
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  525  
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12 @526  	return ret;
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  527  }
68e342b3068cae drivers/media/video/omap3isp/isphist.c    David Cohen      2011-02-12  528  

:::::: The code at line 526 was first introduced by commit
:::::: 68e342b3068cae62f3378cb4a1d385734ea52784 [media] omap3isp: Statistics

:::::: TO: David Cohen <dacohen@gmail.com>
:::::: CC: Mauro Carvalho Chehab <mchehab@redhat.com>

---
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: 33146 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-26 12:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-26 11:45 drivers/media/platform/omap3isp/isphist.c:526 omap3isp_hist_init() warn: possible memory leak of 'hist_cfg' kernel test robot
2021-03-26 12:29 kernel test robot

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.