Skip to contentSkip to conversation

drivers/dma-buf/dma-fence.c:1112:51: sparse: sparse: incorrect type in return expression (different address spaces)

PATCH kernel test robot 1 participant 1 message Jun 16, 2025

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   050f8ad7b58d9079455af171ac279c4b9b828c11
commit: 506aa8b02a8d6898c64cc095d233fbae1cef8b8a [2144/2828] dma-fence: Add safe access helpers and document the rules
config: m68k-randconfig-r132-20250616 (https://download.01.org/0day-ci/archive/20250616/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 8.5.0
reproduce: (https://download.01.org/0day-ci/archive/20250616/[email protected]/reproduce)

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
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)

>> drivers/dma-buf/dma-fence.c:1112:51: sparse: sparse: incorrect type in return expression (different address spaces) @@     expected char const [noderef] __rcu * @@     got char const * @@
   drivers/dma-buf/dma-fence.c:1112:51: sparse:     expected char const [noderef] __rcu *
   drivers/dma-buf/dma-fence.c:1112:51: sparse:     got char const *
>> drivers/dma-buf/dma-fence.c:1114:24: sparse: sparse: incorrect type in return expression (different address spaces) @@     expected char const [noderef] __rcu * @@     got char * @@

drivers/dma-buf/dma-fence.c:1114:24: sparse: expected char const [noderef] __rcu *
drivers/dma-buf/dma-fence.c:1114:24: sparse: got char *
drivers/dma-buf/dma-fence.c:1144:51: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected char const [noderef] __rcu * @@ got char const * @@
drivers/dma-buf/dma-fence.c:1144:51: sparse: expected char const [noderef] __rcu *
drivers/dma-buf/dma-fence.c:1144:51: sparse: got char const *
drivers/dma-buf/dma-fence.c:1146:24: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected char const [noderef] __rcu * @@ got char * @@
drivers/dma-buf/dma-fence.c:1146:24: sparse: expected char const [noderef] __rcu *
drivers/dma-buf/dma-fence.c:1146:24: sparse: got char *

vim +1112 drivers/dma-buf/dma-fence.c

1085
1086 /**
1087 * dma_fence_driver_name - Access the driver name
1088 * @fence: the fence to query
1089 *
1090 * Returns a driver name backing the dma-fence implementation.
1091 *
1092 * IMPORTANT CONSIDERATION:
1093 * Dma-fence contract stipulates that access to driver provided data (data not
1094 * directly embedded into the object itself), such as the &dma_fence.lock and
1095 * memory potentially accessed by the &dma_fence.ops functions, is forbidden
1096 * after the fence has been signalled. Drivers are allowed to free that data,
1097 * and some do.
1098 *
1099 * To allow safe access drivers are mandated to guarantee a RCU grace period
1100 * between signalling the fence and freeing said data.
1101 *
1102 * As such access to the driver name is only valid inside a RCU locked section.
1103 * The pointer MUST be both queried and USED ONLY WITHIN a SINGLE block guarded
1104 * by the &rcu_read_lock and &rcu_read_unlock pair.
1105 */
1106 const char __rcu *dma_fence_driver_name(struct dma_fence *fence)
1107 {
1108 RCU_LOCKDEP_WARN(!rcu_read_lock_held(),
1109 "RCU protection is required for safe access to returned string");
1110
1111 if (!test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))

> 1112			return fence->ops->get_driver_name(fence);
  1113		else
> 1114			return "detached-driver";

1115 }
1116 EXPORT_SYMBOL(dma_fence_driver_name);
1117

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki