]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
ASoC: Intel: avs: Fix kcalloc() sizes
authorThorsten Blum <thorsten.blum@linux.dev>
Sat, 26 Apr 2025 14:13:41 +0000 (16:13 +0200)
committerMark Brown <broonie@kernel.org>
Thu, 1 May 2025 00:26:06 +0000 (09:26 +0900)
rlist, clist, and slist are allocated using sizeof(pointer) instead of
sizeof(*pointer). Fix the allocations by using sizeof(*pointer) and
avoid overallocating memory on 64-bit systems.

Fixes: f2f847461fb7 ("ASoC: Intel: avs: Constrain path based on BE capabilities")
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://patch.msgid.link/20250426141342.94134-2-thorsten.blum@linux.dev
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/avs/path.c

index 04bd20a2ef8d690ff12155bb63cbd7ea1e761f05..ed8f0ea0e10dbb7907bc440dbd4b154fd56c5790 100644 (file)
@@ -131,9 +131,9 @@ int avs_path_set_constraint(struct avs_dev *adev, struct avs_tplg_path_template
        list_for_each_entry(path_template, &template->path_list, node)
                i++;
 
-       rlist = kcalloc(i, sizeof(rlist), GFP_KERNEL);
-       clist = kcalloc(i, sizeof(clist), GFP_KERNEL);
-       slist = kcalloc(i, sizeof(slist), GFP_KERNEL);
+       rlist = kcalloc(i, sizeof(*rlist), GFP_KERNEL);
+       clist = kcalloc(i, sizeof(*clist), GFP_KERNEL);
+       slist = kcalloc(i, sizeof(*slist), GFP_KERNEL);
 
        i = 0;
        list_for_each_entry(path_template, &template->path_list, node) {