drivers/dma-buf/st-dma-fence-unwrap.c:78:39-45: ERROR: reference preceded by free on line 73

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild
Message-ID <[email protected]>
BCC: [email protected]
CC: [email protected]
CC: [email protected]
TO: Jason Gunthorpe <[email protected]>
CC: "Christian König" <[email protected]>

Hi Jason,

First bad commit (maybe != root cause):

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   2f1baf1fc8929e6c48370be543ad028ac7ad4131
commit: 465f3934381c4e9a5bf9fe0eb866275b0ece5a5d dma-buf: Change st-dma-fence-unwrap.c to use kunit
date:   4 months ago
:::::: branch date: 25 hours ago
:::::: commit date: 4 months ago
config: arc-randconfig-r064-20260815 (https://download.01.org/0day-ci/archive/20260815/[email protected]/config)
compiler: arc-linux-gcc (GCC) 12.5.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Fixes: 465f3934381c ("dma-buf: Change st-dma-fence-unwrap.c to use kunit")
| Reported-by: kernel test robot <[email protected]>
| Reported-by: Julia Lawall <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

cocci warnings: (new ones prefixed by >>)
>> drivers/dma-buf/st-dma-fence-unwrap.c:78:39-45: ERROR: reference preceded by free on line 73

vim +78 drivers/dma-buf/st-dma-fence-unwrap.c

d2a0b1bc5773d3 Tvrtko Ursulin  2024-11-15  48  
64a8f92fd783e7 Christian König 2022-03-11  49  static struct dma_fence *mock_array(unsigned int num_fences, ...)
64a8f92fd783e7 Christian König 2022-03-11  50  {
64a8f92fd783e7 Christian König 2022-03-11  51  	struct dma_fence_array *array;
64a8f92fd783e7 Christian König 2022-03-11  52  	struct dma_fence **fences;
64a8f92fd783e7 Christian König 2022-03-11  53  	va_list valist;
64a8f92fd783e7 Christian König 2022-03-11  54  	int i;
64a8f92fd783e7 Christian König 2022-03-11  55  
bf4afc53b77aea Linus Torvalds  2026-02-21  56  	fences = kzalloc_objs(*fences, num_fences);
64a8f92fd783e7 Christian König 2022-03-11  57  	if (!fences)
0c5064fa8d5a02 Christian König 2022-05-04  58  		goto error_put;
64a8f92fd783e7 Christian König 2022-03-11  59  
64a8f92fd783e7 Christian König 2022-03-11  60  	va_start(valist, num_fences);
64a8f92fd783e7 Christian König 2022-03-11  61  	for (i = 0; i < num_fences; ++i)
64a8f92fd783e7 Christian König 2022-03-11  62  		fences[i] = va_arg(valist, typeof(*fences));
64a8f92fd783e7 Christian König 2022-03-11  63  	va_end(valist);
64a8f92fd783e7 Christian König 2022-03-11  64  
64a8f92fd783e7 Christian König 2022-03-11  65  	array = dma_fence_array_create(num_fences, fences,
64a8f92fd783e7 Christian König 2022-03-11  66  				       dma_fence_context_alloc(1),
64a8f92fd783e7 Christian König 2022-03-11  67  				       1, false);
64a8f92fd783e7 Christian König 2022-03-11  68  	if (!array)
0c5064fa8d5a02 Christian König 2022-05-04  69  		goto error_free;
64a8f92fd783e7 Christian König 2022-03-11  70  	return &array->base;
64a8f92fd783e7 Christian König 2022-03-11  71  
0c5064fa8d5a02 Christian König 2022-05-04  72  error_free:
64a8f92fd783e7 Christian König 2022-03-11 @73  	kfree(fences);
0c5064fa8d5a02 Christian König 2022-05-04  74  
0c5064fa8d5a02 Christian König 2022-05-04  75  error_put:
0c5064fa8d5a02 Christian König 2022-05-04  76  	va_start(valist, num_fences);
0c5064fa8d5a02 Christian König 2022-05-04  77  	for (i = 0; i < num_fences; ++i)
0c5064fa8d5a02 Christian König 2022-05-04 @78  		dma_fence_put(va_arg(valist, typeof(*fences)));
0c5064fa8d5a02 Christian König 2022-05-04  79  	va_end(valist);
64a8f92fd783e7 Christian König 2022-03-11  80  	return NULL;
64a8f92fd783e7 Christian König 2022-03-11  81  }
64a8f92fd783e7 Christian König 2022-03-11  82  

:::::: The code at line 78 was first introduced by commit
:::::: 0c5064fa8d5a02dc2dcc6c674a0ad1bbaf79efda dma-buf: cleanup dma_fence_unwrap selftest v2

:::::: TO: Christian König <[email protected]>
:::::: CC: Christian König <[email protected]>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.