sound/core/control.c:1409:5-11: inconsistent IS_ERR and PTR_ERR on line 1410.

From: kernel test robot
Date: Thu Mar 14 2024 - 19:30:56 EST


Hi Takashi,

FYI, the error/warning was bisected to this commit, please ignore it if it's irrelevant.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: fe46a7dd189e25604716c03576d05ac8a5209743
commit: 1052d988226948493eb9730b3424308972eca5f4 ALSA: control: Use automatic cleanup of kfree()
date: 3 weeks ago
config: x86_64-randconfig-103-20240314 (https://download.01.org/0day-ci/archive/20240315/202403150720.IvePtxNs-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.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
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202403150720.IvePtxNs-lkp@xxxxxxxxx/

cocci warnings: (new ones prefixed by >>)
>> sound/core/control.c:1409:5-11: inconsistent IS_ERR and PTR_ERR on line 1410.

vim +1409 sound/core/control.c

^1da177e4c3f41 Linus Torvalds 2005-04-16 1400
82e9bae6fd253a Takashi Iwai 2005-11-17 1401 static int snd_ctl_elem_write_user(struct snd_ctl_file *file,
82e9bae6fd253a Takashi Iwai 2005-11-17 1402 struct snd_ctl_elem_value __user *_control)
^1da177e4c3f41 Linus Torvalds 2005-04-16 1403 {
1052d988226948 Takashi Iwai 2024-02-22 1404 struct snd_ctl_elem_value *control __free(kfree) = NULL;
646494007b48e8 Giuliano Pochini 2006-03-13 1405 struct snd_card *card;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1406 int result;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1407
ef44a1ec6eeef1 Li Zefan 2009-04-10 1408 control = memdup_user(_control, sizeof(*control));
ef44a1ec6eeef1 Li Zefan 2009-04-10 @1409 if (IS_ERR(control))
1052d988226948 Takashi Iwai 2024-02-22 @1410 return PTR_ERR(no_free_ptr(control));
ef44a1ec6eeef1 Li Zefan 2009-04-10 1411
646494007b48e8 Giuliano Pochini 2006-03-13 1412 card = file->card;
646494007b48e8 Giuliano Pochini 2006-03-13 1413 result = snd_ctl_elem_write(card, file, control);
7d8e8292013ab7 Takashi Iwai 2017-08-30 1414 if (result < 0)
1052d988226948 Takashi Iwai 2024-02-22 1415 return result;
7d8e8292013ab7 Takashi Iwai 2017-08-30 1416
^1da177e4c3f41 Linus Torvalds 2005-04-16 1417 if (copy_to_user(_control, control, sizeof(*control)))
1052d988226948 Takashi Iwai 2024-02-22 1418 return -EFAULT;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1419 return result;
^1da177e4c3f41 Linus Torvalds 2005-04-16 1420 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1421

:::::: The code at line 1409 was first introduced by commit
:::::: ef44a1ec6eeef189998f84e7230e1d3535b01074 ALSA: sound/core: use memdup_user()

:::::: TO: Li Zefan <lizf@xxxxxxxxxxxxxx>
:::::: CC: Takashi Iwai <tiwai@xxxxxxx>

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