* [broonie-sound:for-7.4 37/72] sound/soc/soc-dapm.c:2893 snd_soc_dapm_free_widget() warn: variable dereferenced before check 'w->dapm' (see line 2891)
@ 2026-10-18 7:49 kernel test robot
0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-10-18 7:49 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: "Amadeusz Sławiński" <amade@asmblr.net>
CC: Mark Brown <broonie@kernel.org>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.4
head: ba982c33278c1fc739c8c220f410d6539de9d9b9
commit: 568406bc832e7e9e333e2ab05aafd0b83ffb9610 [37/72] ASoC: soc-dapm: Remove widget from cache on removal
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: nios2-randconfig-r2202-20261017 (https://download.01.org/0day-ci/archive/20261018/202610180339.A6POXeNa-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.5.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/202610180339.A6POXeNa-lkp@intel.com/
smatch warnings:
sound/soc/soc-dapm.c:2893 snd_soc_dapm_free_widget() warn: variable dereferenced before check 'w->dapm' (see line 2891)
vim +2893 sound/soc/soc-dapm.c
8872293fc38c49 Lars-Peter Clausen 2013-06-14 2863
da0398099a8348 Cezary Rojewski 2022-03-11 2864 /**
da0398099a8348 Cezary Rojewski 2022-03-11 2865 * snd_soc_dapm_free_widget - Free specified widget
da0398099a8348 Cezary Rojewski 2022-03-11 2866 * @w: widget to free
da0398099a8348 Cezary Rojewski 2022-03-11 2867 *
da0398099a8348 Cezary Rojewski 2022-03-11 2868 * Removes widget from all paths and frees memory occupied by it.
da0398099a8348 Cezary Rojewski 2022-03-11 2869 */
b97e26980f6c13 Lars-Peter Clausen 2015-07-21 2870 void snd_soc_dapm_free_widget(struct snd_soc_dapm_widget *w)
2b97eabc09f42d Richard Purdie 2006-10-06 2871 {
568406bc832e7e Amadeusz Sławiński 2026-10-14 2872 struct snd_soc_dapm_context *d;
2b97eabc09f42d Richard Purdie 2006-10-06 2873 struct snd_soc_dapm_path *p, *next_p;
a3423b02cf745c Lars-Peter Clausen 2015-08-11 2874 enum snd_soc_dapm_direction dir;
2b97eabc09f42d Richard Purdie 2006-10-06 2875
1c9096f32ad23f Kuninori Morimoto 2022-10-17 2876 if (!w)
1c9096f32ad23f Kuninori Morimoto 2022-10-17 2877 return;
1c9096f32ad23f Kuninori Morimoto 2022-10-17 2878
2b97eabc09f42d Richard Purdie 2006-10-06 2879 list_del(&w->list);
5c6679b5cb120f Thomas Hebb 2020-12-12 2880 list_del(&w->dirty);
8ddab3f5107c39 Jarkko Nikula 2010-12-14 2881 /*
8ddab3f5107c39 Jarkko Nikula 2010-12-14 2882 * remove source and sink paths associated to this widget.
8ddab3f5107c39 Jarkko Nikula 2010-12-14 2883 * While removing the path, remove reference to it from both
8ddab3f5107c39 Jarkko Nikula 2010-12-14 2884 * source and sink widgets so that path is removed only once.
8ddab3f5107c39 Jarkko Nikula 2010-12-14 2885 */
af6d53db28e644 Kuninori Morimoto 2026-01-20 2886 dapm_for_each_direction(dir) {
a3423b02cf745c Lars-Peter Clausen 2015-08-11 2887 snd_soc_dapm_widget_for_each_path_safe(w, dir, p, next_p)
8872293fc38c49 Lars-Peter Clausen 2013-06-14 2888 dapm_free_path(p);
a3423b02cf745c Lars-Peter Clausen 2015-08-11 2889 }
8872293fc38c49 Lars-Peter Clausen 2013-06-14 2890
8ad13cdc92f663 Trevor Wu 2023-05-26 @2891 dapm_debugfs_free_widget(w);
8ad13cdc92f663 Trevor Wu 2023-05-26 2892
568406bc832e7e Amadeusz Sławiński 2026-10-14 @2893 if (w->dapm) {
568406bc832e7e Amadeusz Sławiński 2026-10-14 2894 if (w->dapm->card) {
568406bc832e7e Amadeusz Sławiński 2026-10-14 2895 for_each_card_dapms(w->dapm->card, d) {
568406bc832e7e Amadeusz Sławiński 2026-10-14 2896 if (d->wcache_sink == w)
568406bc832e7e Amadeusz Sławiński 2026-10-14 2897 d->wcache_sink = NULL;
568406bc832e7e Amadeusz Sławiński 2026-10-14 2898 if (d->wcache_source == w)
568406bc832e7e Amadeusz Sławiński 2026-10-14 2899 d->wcache_source = NULL;
568406bc832e7e Amadeusz Sławiński 2026-10-14 2900 }
568406bc832e7e Amadeusz Sławiński 2026-10-14 2901 } else {
568406bc832e7e Amadeusz Sławiński 2026-10-14 2902 if (w->dapm->wcache_sink == w)
568406bc832e7e Amadeusz Sławiński 2026-10-14 2903 w->dapm->wcache_sink = NULL;
568406bc832e7e Amadeusz Sławiński 2026-10-14 2904 if (w->dapm->wcache_source == w)
568406bc832e7e Amadeusz Sławiński 2026-10-14 2905 w->dapm->wcache_source = NULL;
568406bc832e7e Amadeusz Sławiński 2026-10-14 2906 }
568406bc832e7e Amadeusz Sławiński 2026-10-14 2907 }
568406bc832e7e Amadeusz Sławiński 2026-10-14 2908
fad598887dc0d8 Stephen Warren 2011-04-28 2909 kfree(w->kcontrols);
48068961751038 Lars-Peter Clausen 2015-07-21 2910 kfree_const(w->name);
199ed3e81c49a6 Pierre-Louis Bossart 2019-02-01 2911 kfree_const(w->sname);
8ddab3f5107c39 Jarkko Nikula 2010-12-14 2912 kfree(w);
8ddab3f5107c39 Jarkko Nikula 2010-12-14 2913 }
da0398099a8348 Cezary Rojewski 2022-03-11 2914 EXPORT_SYMBOL_GPL(snd_soc_dapm_free_widget);
b97e26980f6c13 Lars-Peter Clausen 2015-07-21 2915
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread* [broonie-sound:for-7.4 37/72] sound/soc/soc-dapm.c:2893 snd_soc_dapm_free_widget() warn: variable dereferenced before check 'w->dapm' (see line 2891)
@ 2026-10-19 8:17 Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2026-10-19 8:17 UTC (permalink / raw)
To: oe-kbuild, Amadeusz Sławiński; +Cc: lkp, oe-kbuild-all, Mark Brown
Sorry for sending this without a subject... :(
tree: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.4
head: ba982c33278c1fc739c8c220f410d6539de9d9b9
commit: 568406bc832e7e9e333e2ab05aafd0b83ffb9610 [37/72] ASoC: soc-dapm: Remove widget from cache on removal
config: nios2-randconfig-r2202-20261017 (https://download.01.org/0day-ci/archive/20261018/202610180339.A6POXeNa-lkp@intel.com/config)
compiler: nios2-linux-gcc (GCC) 11.5.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/202610180339.A6POXeNa-lkp@intel.com/
smatch warnings:
sound/soc/soc-dapm.c:2893 snd_soc_dapm_free_widget() warn: variable dereferenced before check 'w->dapm' (see line 2891)
vim +2893 sound/soc/soc-dapm.c
b97e26980f6c13 Lars-Peter Clausen 2015-07-21 2870 void snd_soc_dapm_free_widget(struct snd_soc_dapm_widget *w)
2b97eabc09f42d Richard Purdie 2006-10-06 2871 {
568406bc832e7e Amadeusz Sławiński 2026-10-14 2872 struct snd_soc_dapm_context *d;
2b97eabc09f42d Richard Purdie 2006-10-06 2873 struct snd_soc_dapm_path *p, *next_p;
a3423b02cf745c Lars-Peter Clausen 2015-08-11 2874 enum snd_soc_dapm_direction dir;
2b97eabc09f42d Richard Purdie 2006-10-06 2875
1c9096f32ad23f Kuninori Morimoto 2022-10-17 2876 if (!w)
1c9096f32ad23f Kuninori Morimoto 2022-10-17 2877 return;
1c9096f32ad23f Kuninori Morimoto 2022-10-17 2878
2b97eabc09f42d Richard Purdie 2006-10-06 2879 list_del(&w->list);
5c6679b5cb120f Thomas Hebb 2020-12-12 2880 list_del(&w->dirty);
8ddab3f5107c39 Jarkko Nikula 2010-12-14 2881 /*
8ddab3f5107c39 Jarkko Nikula 2010-12-14 2882 * remove source and sink paths associated to this widget.
8ddab3f5107c39 Jarkko Nikula 2010-12-14 2883 * While removing the path, remove reference to it from both
8ddab3f5107c39 Jarkko Nikula 2010-12-14 2884 * source and sink widgets so that path is removed only once.
8ddab3f5107c39 Jarkko Nikula 2010-12-14 2885 */
af6d53db28e644 Kuninori Morimoto 2026-01-20 2886 dapm_for_each_direction(dir) {
a3423b02cf745c Lars-Peter Clausen 2015-08-11 2887 snd_soc_dapm_widget_for_each_path_safe(w, dir, p, next_p)
8872293fc38c49 Lars-Peter Clausen 2013-06-14 2888 dapm_free_path(p);
a3423b02cf745c Lars-Peter Clausen 2015-08-11 2889 }
8872293fc38c49 Lars-Peter Clausen 2013-06-14 2890
8ad13cdc92f663 Trevor Wu 2023-05-26 @2891 dapm_debugfs_free_widget(w);
^
This dereferences "w->dapm"
8ad13cdc92f663 Trevor Wu 2023-05-26 2892
568406bc832e7e Amadeusz Sławiński 2026-10-14 @2893 if (w->dapm) {
^^^^^^^
So this check is too late.
568406bc832e7e Amadeusz Sławiński 2026-10-14 2894 if (w->dapm->card) {
568406bc832e7e Amadeusz Sławiński 2026-10-14 2895 for_each_card_dapms(w->dapm->card, d) {
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-19 8:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-18 7:49 [broonie-sound:for-7.4 37/72] sound/soc/soc-dapm.c:2893 snd_soc_dapm_free_widget() warn: variable dereferenced before check 'w->dapm' (see line 2891) kernel test robot
-- strict thread matches above, loose matches on Subject: below --
2026-10-19 8:17 Dan Carpenter
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.