]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ASoC: Intel: avs: Verify kcalloc() status when setting constraints
authorCezary Rojewski <cezary.rojewski@intel.com>
Fri, 30 May 2025 14:10:22 +0000 (16:10 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 2 Jun 2025 11:26:49 +0000 (12:26 +0100)
All memory operations shall be checked.

Fixes: f2f847461fb7 ("ASoC: Intel: avs: Constrain path based on BE capabilities")
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/20250530141025.2942936-7-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/avs/path.c

index ed8f0ea0e10dbb7907bc440dbd4b154fd56c5790..e8e6b1c7fc903bf62eeb0067764ee785a1ffabc7 100644 (file)
@@ -134,6 +134,8 @@ int avs_path_set_constraint(struct avs_dev *adev, struct avs_tplg_path_template
        rlist = kcalloc(i, sizeof(*rlist), GFP_KERNEL);
        clist = kcalloc(i, sizeof(*clist), GFP_KERNEL);
        slist = kcalloc(i, sizeof(*slist), GFP_KERNEL);
+       if (!rlist || !clist || !slist)
+               return -ENOMEM;
 
        i = 0;
        list_for_each_entry(path_template, &template->path_list, node) {