Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: SDCA: Add allocation failure check for Entity name

Currently find_sdca_entity_iot() can allocate a string for the
Entity name but it doesn't check if that allocation succeeded.
Add the missing NULL check after the allocation.

Fixes: 48fa77af2f4a ("ASoC: SDCA: Add terminal type into input/output widget name")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20260303141707.3841635-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Charles Keepax and committed by
Mark Brown
27990181 70c30545

+4 -1
+4 -1
sound/soc/sdca/sdca_functions.c
··· 1156 1156 if (!terminal->is_dataport) { 1157 1157 const char *type_name = sdca_find_terminal_name(terminal->type); 1158 1158 1159 - if (type_name) 1159 + if (type_name) { 1160 1160 entity->label = devm_kasprintf(dev, GFP_KERNEL, "%s %s", 1161 1161 entity->label, type_name); 1162 + if (!entity->label) 1163 + return -ENOMEM; 1164 + } 1162 1165 } 1163 1166 1164 1167 ret = fwnode_property_read_u32(entity_node,