From: David Henningsson Date: Fri, 5 Feb 2016 08:05:41 +0000 (+0100) Subject: ALSA: hda - Fix static checker warning in patch_hdmi.c X-Git-Tag: v4.1.12-92~150^2~226 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=767eea5248e5f3d3d93209b5f2e506a9085aeaee;p=users%2Fjedix%2Flinux-maple.git ALSA: hda - Fix static checker warning in patch_hdmi.c Orabug: 23330832 [ Upstream commit 360a8245680053619205a3ae10e6bfe624a5da1d ] The static checker warning is: sound/pci/hda/patch_hdmi.c:460 hdmi_eld_ctl_get() error: __memcpy() 'eld->eld_buffer' too small (256 vs 512) I have a hard time figuring out if this can ever cause an information leak (I don't think so), but nonetheless it does not hurt to increase the robustness of the code. Fixes: 68e03de98507 ('ALSA: hda - hdmi: Do not expose eld data when eld is invalid') Reported-by: Dan Carpenter Signed-off-by: David Henningsson Cc: # v3.9+ Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin (cherry picked from commit 6cf9d4c32e8e2716eb8e9cb578dbcb2b2cad04b3) Signed-off-by: Dan Duval --- diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 225b78b4ef125..58a24624ecc0c 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -432,7 +432,8 @@ static int hdmi_eld_ctl_get(struct snd_kcontrol *kcontrol, eld = &per_pin->sink_eld; mutex_lock(&per_pin->lock); - if (eld->eld_size > ARRAY_SIZE(ucontrol->value.bytes.data)) { + if (eld->eld_size > ARRAY_SIZE(ucontrol->value.bytes.data) || + eld->eld_size > ELD_MAX_SIZE) { mutex_unlock(&per_pin->lock); snd_BUG(); return -EINVAL;