Skip to content

Commit 2799018

Browse files
charleskeepaxbroonie
authored andcommitted
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: 48fa77a ("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>
1 parent 70c3054 commit 2799018

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

sound/soc/sdca/sdca_functions.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,9 +1156,12 @@ static int find_sdca_entity_iot(struct device *dev,
11561156
if (!terminal->is_dataport) {
11571157
const char *type_name = sdca_find_terminal_name(terminal->type);
11581158

1159-
if (type_name)
1159+
if (type_name) {
11601160
entity->label = devm_kasprintf(dev, GFP_KERNEL, "%s %s",
11611161
entity->label, type_name);
1162+
if (!entity->label)
1163+
return -ENOMEM;
1164+
}
11621165
}
11631166

11641167
ret = fwnode_property_read_u32(entity_node,

0 commit comments

Comments
 (0)