From: "Péter Ujfalusi" <peter.ujfalusi@linux.intel.com>
To: Dan Carpenter <error27@gmail.com>, oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
Takashi Iwai <tiwai@suse.de>
Subject: Re: [linux-next:master 18830/19064] sound/core/compress_offload.c:716 snd_compr_set_params() warn: missing error code? 'retval'
Date: Wed, 21 Oct 2026 09:05:53 +0300 [thread overview]
Message-ID: <38cf4318-faa9-4d6a-9e26-56cf4e312df1@linux.intel.com> (raw)
In-Reply-To: <202610202334.hwrqtbb4-lkp@intel.com>
On 21/10/2026 08:54, Dan Carpenter wrote:
> 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
> 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
>
> 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;
>
> This should either be "return -ESOMETHING;" or "return 0;". The current
> code returns zero but in an obfuscated way.
the same form was present before fbc74ca9fbf7e0.
The intention was to return 0 here.
Ah, I see, 9b02221422a55e was a mechanical change to switch to
*params __free(kfree) = NULL;
replacing a goto out with a return.
>
> 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;
>
> This could be deleted because of the above check.
>
> 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 }
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
--
Péter
prev parent reply other threads:[~2026-10-21 6:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=38cf4318-faa9-4d6a-9e26-56cf4e312df1@linux.intel.com \
--to=peter.ujfalusi@linux.intel.com \
--cc=error27@gmail.com \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.