All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 18830/19064] sound/core/compress_offload.c:716 snd_compr_set_params() warn: missing error code? 'retval'
@ 2026-10-21  5:54 ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: kernel test robot @ 2026-10-20 21:08 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

Unfiltered warning: this smatch report is sent as-is and has not been
reviewed for false positives, so please treat it with due skepticism.

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
CC: Takashi Iwai <tiwai@suse.de>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   8f7df005a7564bd7ffa75da9c3085d5b996f1e16
commit: fbc74ca9fbf7e0b8f6872ccac62f9f4a1f3b5e53 [18830/19064] ALSA: compress: fix buffer leak on failed SET_PARAMS
:::::: branch date: 7 hours ago
:::::: commit date: 12 hours ago
config: i386-randconfig-2200-20261020 (https://download.01.org/0day-ci/archive/20261020/202610202334.hwrqtbb4-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.4.0-5) 12.4.0
smatch: v0.5.0-9187-g5189e3fb

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@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202610202334.hwrqtbb4-lkp@intel.com/

smatch warnings:
sound/core/compress_offload.c:716 snd_compr_set_params() warn: missing error code? 'retval'

vim +/retval +716 sound/core/compress_offload.c

4dc040a0b34890 Vinod Koul          2012-09-17  679  
b21c60a4edd22e Vinod Koul          2011-12-23  680  static int
b21c60a4edd22e Vinod Koul          2011-12-23  681  snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg)
b21c60a4edd22e Vinod Koul          2011-12-23  682  {
b21c60a4edd22e Vinod Koul          2011-12-23  683  	int retval;
b21c60a4edd22e Vinod Koul          2011-12-23  684  
7ea9ee0064281e Srinivas Kandagatla 2023-06-19  685  	if (stream->runtime->state == SNDRV_PCM_STATE_OPEN || stream->next_track) {
b21c60a4edd22e Vinod Koul          2011-12-23  686  		/*
b21c60a4edd22e Vinod Koul          2011-12-23  687  		 * we should allow parameter change only when stream has been
b21c60a4edd22e Vinod Koul          2011-12-23  688  		 * opened not in other cases
b21c60a4edd22e Vinod Koul          2011-12-23  689  		 */
14324b8f0760ca Takashi Iwai        2025-12-16  690  		struct snd_compr_params *params __free(kfree) =
14324b8f0760ca Takashi Iwai        2025-12-16  691  			memdup_user((void __user *)arg, sizeof(*params));
14324b8f0760ca Takashi Iwai        2025-12-16  692  
c2f14ba749c1ce Markus Elfring      2016-08-21  693  		if (IS_ERR(params))
40a024b81d1cba Takashi Iwai        2024-09-02  694  			return PTR_ERR(params);
4dc040a0b34890 Vinod Koul          2012-09-17  695  
04177158cf98a7 Jaroslav Kysela     2024-10-02  696  		retval = snd_compress_check_input(stream, params);
4dc040a0b34890 Vinod Koul          2012-09-17  697  		if (retval)
9b02221422a55e Takashi Iwai        2024-02-22  698  			return retval;
4dc040a0b34890 Vinod Koul          2012-09-17  699  
b21c60a4edd22e Vinod Koul          2011-12-23  700  		retval = snd_compr_allocate_buffer(stream, params);
9b02221422a55e Takashi Iwai        2024-02-22  701  		if (retval)
9b02221422a55e Takashi Iwai        2024-02-22  702  			return -ENOMEM;
4dc040a0b34890 Vinod Koul          2012-09-17  703  
b21c60a4edd22e Vinod Koul          2011-12-23  704  		retval = stream->ops->set_params(stream, params);
fbc74ca9fbf7e0 Peter Ujfalusi      2026-10-19  705  		if (retval) {
fbc74ca9fbf7e0 Peter Ujfalusi      2026-10-19  706  			/* the stream stays OPEN: drop the buffer of the rejected setup */
fbc74ca9fbf7e0 Peter Ujfalusi      2026-10-19  707  			if (stream->runtime->state == SNDRV_PCM_STATE_OPEN &&
fbc74ca9fbf7e0 Peter Ujfalusi      2026-10-19  708  			    !stream->runtime->dma_buffer_p) {
fbc74ca9fbf7e0 Peter Ujfalusi      2026-10-19  709  				kfree(stream->runtime->buffer);
fbc74ca9fbf7e0 Peter Ujfalusi      2026-10-19  710  				stream->runtime->buffer = NULL;
fbc74ca9fbf7e0 Peter Ujfalusi      2026-10-19  711  			}
9b02221422a55e Takashi Iwai        2024-02-22  712  			return retval;
fbc74ca9fbf7e0 Peter Ujfalusi      2026-10-19  713  		}
49bb6402f1aa1e Charles Keepax      2013-04-18  714  
7ea9ee0064281e Srinivas Kandagatla 2023-06-19  715  		if (stream->next_track)
9b02221422a55e Takashi Iwai        2024-02-22 @716  			return retval;
7ea9ee0064281e Srinivas Kandagatla 2023-06-19  717  
9727b490e543de Jeeja KP            2013-02-14  718  		stream->metadata_set = false;
9727b490e543de Jeeja KP            2013-02-14  719  		stream->next_track = false;
49bb6402f1aa1e Charles Keepax      2013-04-18  720  
49bb6402f1aa1e Charles Keepax      2013-04-18  721  		stream->runtime->state = SNDRV_PCM_STATE_SETUP;
769fab2a41da4b Jesper Juhl         2012-01-23  722  	} else {
b21c60a4edd22e Vinod Koul          2011-12-23  723  		return -EPERM;
769fab2a41da4b Jesper Juhl         2012-01-23  724  	}
b21c60a4edd22e Vinod Koul          2011-12-23  725  	return retval;
b21c60a4edd22e Vinod Koul          2011-12-23  726  }
b21c60a4edd22e Vinod Koul          2011-12-23  727  

:::::: The code at line 716 was first introduced by commit
:::::: 9b02221422a55e834469fdc91dc4d5147f5a1fb9 ALSA: compress_offload: Use automatic cleanup of kfree()

:::::: TO: Takashi Iwai <tiwai@suse.de>
:::::: CC: Takashi Iwai <tiwai@suse.de>

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-21  6:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-20 21:08 [linux-next:master 18830/19064] sound/core/compress_offload.c:716 snd_compr_set_params() warn: missing error code? 'retval' kernel test robot
2026-10-21  5:54 ` Dan Carpenter
2026-10-21  6:05 ` Péter Ujfalusi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.