2024-03-15 10:31:16

by kernel test robot

[permalink] [raw]
Subject: sound/core/compress_offload.c:595:6-12: inconsistent IS_ERR and PTR_ERR on line 596.

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: e5eb28f6d1afebed4bb7d740a797d0390bd3a357
commit: 9b02221422a55e834469fdc91dc4d5147f5a1fb9 ALSA: compress_offload: Use automatic cleanup of kfree()
date: 3 weeks ago
config: x86_64-randconfig-103-20240314 (https://download.01.org/0day-ci/archive/20240315/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

cocci warnings: (new ones prefixed by >>)
>> sound/core/compress_offload.c:595:6-12: inconsistent IS_ERR and PTR_ERR on line 596.

vim +595 sound/core/compress_offload.c

4dc040a0b34890 Vinod Koul 2012-09-17 582
b21c60a4edd22e Vinod Koul 2011-12-23 583 static int
b21c60a4edd22e Vinod Koul 2011-12-23 584 snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg)
b21c60a4edd22e Vinod Koul 2011-12-23 585 {
9b02221422a55e Takashi Iwai 2024-02-22 586 struct snd_compr_params *params __free(kfree) = NULL;
b21c60a4edd22e Vinod Koul 2011-12-23 587 int retval;
b21c60a4edd22e Vinod Koul 2011-12-23 588
7ea9ee0064281e Srinivas Kandagatla 2023-06-19 589 if (stream->runtime->state == SNDRV_PCM_STATE_OPEN || stream->next_track) {
b21c60a4edd22e Vinod Koul 2011-12-23 590 /*
b21c60a4edd22e Vinod Koul 2011-12-23 591 * we should allow parameter change only when stream has been
b21c60a4edd22e Vinod Koul 2011-12-23 592 * opened not in other cases
b21c60a4edd22e Vinod Koul 2011-12-23 593 */
c2f14ba749c1ce Markus Elfring 2016-08-21 594 params = memdup_user((void __user *)arg, sizeof(*params));
c2f14ba749c1ce Markus Elfring 2016-08-21 @595 if (IS_ERR(params))
9b02221422a55e Takashi Iwai 2024-02-22 @596 return PTR_ERR(no_free_ptr(params));
4dc040a0b34890 Vinod Koul 2012-09-17 597
4dc040a0b34890 Vinod Koul 2012-09-17 598 retval = snd_compress_check_input(params);
4dc040a0b34890 Vinod Koul 2012-09-17 599 if (retval)
9b02221422a55e Takashi Iwai 2024-02-22 600 return retval;
4dc040a0b34890 Vinod Koul 2012-09-17 601
b21c60a4edd22e Vinod Koul 2011-12-23 602 retval = snd_compr_allocate_buffer(stream, params);
9b02221422a55e Takashi Iwai 2024-02-22 603 if (retval)
9b02221422a55e Takashi Iwai 2024-02-22 604 return -ENOMEM;
4dc040a0b34890 Vinod Koul 2012-09-17 605
b21c60a4edd22e Vinod Koul 2011-12-23 606 retval = stream->ops->set_params(stream, params);
b21c60a4edd22e Vinod Koul 2011-12-23 607 if (retval)
9b02221422a55e Takashi Iwai 2024-02-22 608 return retval;
49bb6402f1aa1e Charles Keepax 2013-04-18 609
7ea9ee0064281e Srinivas Kandagatla 2023-06-19 610 if (stream->next_track)
9b02221422a55e Takashi Iwai 2024-02-22 611 return retval;
7ea9ee0064281e Srinivas Kandagatla 2023-06-19 612
9727b490e543de Jeeja KP 2013-02-14 613 stream->metadata_set = false;
9727b490e543de Jeeja KP 2013-02-14 614 stream->next_track = false;
49bb6402f1aa1e Charles Keepax 2013-04-18 615
49bb6402f1aa1e Charles Keepax 2013-04-18 616 stream->runtime->state = SNDRV_PCM_STATE_SETUP;
769fab2a41da4b Jesper Juhl 2012-01-23 617 } else {
b21c60a4edd22e Vinod Koul 2011-12-23 618 return -EPERM;
769fab2a41da4b Jesper Juhl 2012-01-23 619 }
b21c60a4edd22e Vinod Koul 2011-12-23 620 return retval;
b21c60a4edd22e Vinod Koul 2011-12-23 621 }
b21c60a4edd22e Vinod Koul 2011-12-23 622

:::::: The code at line 595 was first introduced by commit
:::::: c2f14ba749c1ce94aa97c5a84733a89aaaadada4 ALSA: compress: Use memdup_user() rather than duplicating its implementation

:::::: TO: Markus Elfring <[email protected]>
:::::: CC: Takashi Iwai <[email protected]>

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