mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
ASoC: tegra-alt: check the allocation of dai link
kzalloc() can be failed under low memory condition. In such a case, the following memcpy() can cause a panic. Thus, the return value of kzalloc() should be checked. If tegra_machine_get_dai_link_t18x() is called, the return value should also be checked. Bug 2647682 Change-Id: Ia200436a3b1877933932b9a086862f5507c8da54 Signed-off-by: Kwangwoo Lee <kwangwool@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2159959 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Sameer Pujar <spujar@nvidia.com> Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Sameer Pujar
parent
425bac4962
commit
4f168be948
@@ -2915,6 +2915,9 @@ struct snd_soc_dai_link *tegra_machine_get_dai_link(void)
|
|||||||
tegra_asoc_machine_links = kzalloc(size *
|
tegra_asoc_machine_links = kzalloc(size *
|
||||||
sizeof(struct snd_soc_dai_link), GFP_KERNEL);
|
sizeof(struct snd_soc_dai_link), GFP_KERNEL);
|
||||||
|
|
||||||
|
if (!tegra_asoc_machine_links)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
memcpy(tegra_asoc_machine_links, link,
|
memcpy(tegra_asoc_machine_links, link,
|
||||||
size * sizeof(struct snd_soc_dai_link));
|
size * sizeof(struct snd_soc_dai_link));
|
||||||
|
|
||||||
@@ -3024,6 +3027,9 @@ struct snd_soc_codec_conf *tegra_machine_get_codec_conf(void)
|
|||||||
tegra_asoc_codec_conf = kzalloc(size *
|
tegra_asoc_codec_conf = kzalloc(size *
|
||||||
sizeof(struct snd_soc_codec_conf), GFP_KERNEL);
|
sizeof(struct snd_soc_codec_conf), GFP_KERNEL);
|
||||||
|
|
||||||
|
if (!tegra_asoc_codec_conf)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
memcpy(tegra_asoc_codec_conf, conf,
|
memcpy(tegra_asoc_codec_conf, conf,
|
||||||
size * sizeof(struct snd_soc_codec_conf));
|
size * sizeof(struct snd_soc_codec_conf));
|
||||||
|
|
||||||
@@ -3446,6 +3452,9 @@ struct snd_soc_dai_link *tegra_machine_get_dai_link_t18x(void)
|
|||||||
tegra_asoc_machine_links_t18x = kzalloc(size *
|
tegra_asoc_machine_links_t18x = kzalloc(size *
|
||||||
sizeof(struct snd_soc_dai_link), GFP_KERNEL);
|
sizeof(struct snd_soc_dai_link), GFP_KERNEL);
|
||||||
|
|
||||||
|
if (!tegra_asoc_machine_links_t18x)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
memcpy(tegra_asoc_machine_links_t18x, link,
|
memcpy(tegra_asoc_machine_links_t18x, link,
|
||||||
size * sizeof(struct snd_soc_dai_link));
|
size * sizeof(struct snd_soc_dai_link));
|
||||||
|
|
||||||
@@ -3504,6 +3513,9 @@ struct snd_soc_codec_conf *tegra_machine_get_codec_conf_t18x(void)
|
|||||||
tegra_asoc_codec_conf_t18x = kzalloc(size *
|
tegra_asoc_codec_conf_t18x = kzalloc(size *
|
||||||
sizeof(struct snd_soc_codec_conf), GFP_KERNEL);
|
sizeof(struct snd_soc_codec_conf), GFP_KERNEL);
|
||||||
|
|
||||||
|
if (!tegra_asoc_codec_conf_t18x)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
memcpy(tegra_asoc_codec_conf_t18x, conf,
|
memcpy(tegra_asoc_codec_conf_t18x, conf,
|
||||||
size * sizeof(struct snd_soc_codec_conf));
|
size * sizeof(struct snd_soc_codec_conf));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user