Skip to content

Commit

Permalink
ASoC: rt5645: fix a NULL pointer dereference
Browse files Browse the repository at this point in the history
devm_kcalloc() may fail and return NULL. The fix returns ENOMEM
in case it fails to avoid NULL pointer dereference.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Kangjie Lu authored and Mark Brown committed May 2, 2019
1 parent d3692cb commit 51dd97d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sound/soc/codecs/rt5645.c
Original file line number Diff line number Diff line change
Expand Up @@ -3419,6 +3419,9 @@ static int rt5645_probe(struct snd_soc_component *component)
RT5645_HWEQ_NUM, sizeof(struct rt5645_eq_param_s),
GFP_KERNEL);

if (!rt5645->eq_param)
return -ENOMEM;

return 0;
}

Expand Down

0 comments on commit 51dd97d

Please sign in to comment.