sound/core/pcm_native.c:3308:6: error: cannot jump from this asm goto statement to one of its possible targets
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master head: 1058ca9db0edaedcb16480cc74b78ed06f0d1f54 commit: f3d233daf011abbad2f6ebd0e545b42d2f378a4f [1917/2322] ALSA: pcm: Relax __free() variable declarations config: riscv-allyesconfig (https://download.01.org/0day-ci/archive/20251219/[email protected]/config) compiler: clang version 16.0.6 (https://github.com/llvm/llvm-project 7cbf1a2591520c2491aa35339f227775f4d3adf6) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251219/[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]/
All errors (new ones prefixed by >>):
>> sound/core/pcm_native.c:3308:6: error: cannot jump from this asm goto statement to one of its possible targets
if (put_user(result, &_xfern->result))
^
arch/riscv/include/asm/uaccess.h:403:3: note: expanded from macro 'put_user'
__put_user((x), __p) : \
^
arch/riscv/include/asm/uaccess.h:376:2: note: expanded from macro '__put_user'
__put_user_error(__val, __gu_ptr, __pu_err); \
^
arch/riscv/include/asm/uaccess.h:340:2: note: expanded from macro '__put_user_error'
__put_user_nocheck(x, ptr, err_label); \
^
arch/riscv/include/asm/uaccess.h:321:3: note: expanded from macro '__put_user_nocheck'
__put_user_asm("sb", (x), __gu_ptr, label); \
^
arch/riscv/include/asm/uaccess.h:282:2: note: expanded from macro '__put_user_asm'
asm goto( \
^
sound/core/pcm_native.c:3295:6: note: possible target of asm goto statement
if (put_user(0, &_xfern->result))
^
arch/riscv/include/asm/uaccess.h:403:3: note: expanded from macro 'put_user'
__put_user((x), __p) : \
^
arch/riscv/include/asm/uaccess.h:376:2: note: expanded from macro '__put_user'
__put_user_error(__val, __gu_ptr, __pu_err); \
^
arch/riscv/include/asm/uaccess.h:341:15: note: expanded from macro '__put_user_error'
break; \
^
sound/core/pcm_native.c:3300:8: note: jump exits scope of variable with __attribute__((cleanup))
void *bufs __free(kfree) =
^
sound/core/pcm_native.c:3295:6: error: cannot jump from this asm goto statement to one of its possible targets
if (put_user(0, &_xfern->result))
^
arch/riscv/include/asm/uaccess.h:403:3: note: expanded from macro 'put_user'
__put_user((x), __p) : \
^
arch/riscv/include/asm/uaccess.h:376:2: note: expanded from macro '__put_user'
__put_user_error(__val, __gu_ptr, __pu_err); \
^
arch/riscv/include/asm/uaccess.h:340:2: note: expanded from macro '__put_user_error'
__put_user_nocheck(x, ptr, err_label); \
^
arch/riscv/include/asm/uaccess.h:321:3: note: expanded from macro '__put_user_nocheck'
__put_user_asm("sb", (x), __gu_ptr, label); \
^
arch/riscv/include/asm/uaccess.h:282:2: note: expanded from macro '__put_user_asm'
asm goto( \
^
sound/core/pcm_native.c:3308:6: note: possible target of asm goto statement
if (put_user(result, &_xfern->result))
^
arch/riscv/include/asm/uaccess.h:403:3: note: expanded from macro 'put_user'
__put_user((x), __p) : \
^
arch/riscv/include/asm/uaccess.h:376:2: note: expanded from macro '__put_user'
__put_user_error(__val, __gu_ptr, __pu_err); \
^
arch/riscv/include/asm/uaccess.h:341:15: note: expanded from macro '__put_user_error'
break; \
^ sound/core/pcm_native.c:3300:8: note: jump bypasses initialization of variable with __attribute__((cleanup))
void *bufs __free(kfree) =
^
2 errors generated.
vim +3308 sound/core/pcm_native.c
67616feda99e32 Takashi Iwai 2017-08-30 3283
67616feda99e32 Takashi Iwai 2017-08-30 3284 static int snd_pcm_xfern_frames_ioctl(struct snd_pcm_substream *substream,
67616feda99e32 Takashi Iwai 2017-08-30 3285 struct snd_xfern __user *_xfern)
67616feda99e32 Takashi Iwai 2017-08-30 3286 {
67616feda99e32 Takashi Iwai 2017-08-30 3287 struct snd_xfern xfern;
67616feda99e32 Takashi Iwai 2017-08-30 3288 struct snd_pcm_runtime *runtime = substream->runtime;
67616feda99e32 Takashi Iwai 2017-08-30 3289 snd_pcm_sframes_t result;
67616feda99e32 Takashi Iwai 2017-08-30 3290
f0061c18c169f0 Takashi Iwai 2022-09-26 3291 if (runtime->state == SNDRV_PCM_STATE_OPEN)
67616feda99e32 Takashi Iwai 2017-08-30 3292 return -EBADFD;
67616feda99e32 Takashi Iwai 2017-08-30 3293 if (runtime->channels > 128)
67616feda99e32 Takashi Iwai 2017-08-30 3294 return -EINVAL;
67616feda99e32 Takashi Iwai 2017-08-30 3295 if (put_user(0, &_xfern->result))
67616feda99e32 Takashi Iwai 2017-08-30 3296 return -EFAULT;
67616feda99e32 Takashi Iwai 2017-08-30 3297 if (copy_from_user(&xfern, _xfern, sizeof(xfern)))
67616feda99e32 Takashi Iwai 2017-08-30 3298 return -EFAULT;
67616feda99e32 Takashi Iwai 2017-08-30 3299
f3d233daf011ab Takashi Iwai 2025-12-16 3300 void *bufs __free(kfree) =
f3d233daf011ab Takashi Iwai 2025-12-16 3301 memdup_array_user(xfern.bufs, runtime->channels, sizeof(void *));
67616feda99e32 Takashi Iwai 2017-08-30 3302 if (IS_ERR(bufs))
40a024b81d1cba Takashi Iwai 2024-09-02 3303 return PTR_ERR(bufs);
67616feda99e32 Takashi Iwai 2017-08-30 3304 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
67616feda99e32 Takashi Iwai 2017-08-30 3305 result = snd_pcm_lib_writev(substream, bufs, xfern.frames);
67616feda99e32 Takashi Iwai 2017-08-30 3306 else
67616feda99e32 Takashi Iwai 2017-08-30 3307 result = snd_pcm_lib_readv(substream, bufs, xfern.frames);
ebe6976d3634a3 Al Viro 2020-03-19 @3308 if (put_user(result, &_xfern->result))
ebe6976d3634a3 Al Viro 2020-03-19 3309 return -EFAULT;
67616feda99e32 Takashi Iwai 2017-08-30 3310 return result < 0 ? result : 0;
67616feda99e32 Takashi Iwai 2017-08-30 3311 }67616feda99e32 Takashi Iwai 2017-08-30 3312
:::::: The code at line 3308 was first introduced by commit
:::::: ebe6976d3634a311367f72c2402f148ab9f23920 pcm_native: result of put_user() needs to be checked
:::::: TO: Al Viro <[email protected]>
:::::: CC: Al Viro <[email protected]>
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki