From: Sudip Mukherjee Date: Mon, 23 Nov 2015 12:15:13 +0000 (+0530) Subject: ASoC: hdac_hdmi: fix possible NULL dereference X-Git-Tag: v4.5-rc1~80^2~26^2~1^2~6^4~49 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=8d33ab24242c5ce2f8e4add8c04d5409e36a330c;p=linux.git ASoC: hdac_hdmi: fix possible NULL dereference kzalloc() can return NULL if it fails, and then we will be dereferencing a NULL pointer. Signed-off-by: Sudip Mukherjee Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c index d1552620257f..205f2c27263d 100644 --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c @@ -200,6 +200,8 @@ static int hdac_hdmi_set_hw_params(struct snd_pcm_substream *substream, } dd = kzalloc(sizeof(*dd), GFP_KERNEL); + if (!dd) + return -ENOMEM; dd->format = snd_hdac_calc_stream_format(params_rate(hparams), params_channels(hparams), params_format(hparams), 24, 0);