Skip to content

Commit 6325766

Browse files
tobluxbroonie
authored andcommitted
ASoC: sdw_utils: Fix potential NULL pointer deref in is_sdca_endpoint_present()
Check the return value of kzalloc() and exit early to avoid a potential NULL pointer dereference. Cc: [email protected] Fixes: 4f8ef33 ("ASoC: soc_sdw_utils: skip the endpoint that doesn't present") Signed-off-by: Thorsten Blum <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent a4e469c commit 6325766

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sound/soc/sdw_utils/soc_sdw_utils.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1205,6 +1205,8 @@ static int is_sdca_endpoint_present(struct device *dev,
12051205
int i;
12061206

12071207
dlc = kzalloc(sizeof(*dlc), GFP_KERNEL);
1208+
if (!dlc)
1209+
return -ENOMEM;
12081210

12091211
adr_end = &adr_dev->endpoints[end_index];
12101212
dai_info = &codec_info->dais[adr_end->num];

0 commit comments

Comments
 (0)