Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1335473
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer |
| Date | 2016-02-16 15:50 +0100 |
| Message-ID | <r2P6V-Gk-7@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
When CONFIG_SND_JACK is disabled, the hdmi driver tries to create
a new output jack structure and dereferences it even though
the pointer is never assigned:
sound/pci/hda/patch_hdmi.c: In function 'generic_hdmi_build_jack':
sound/pci/hda/patch_hdmi.c:2534:30: error: 'jack' may be used uninitialized in this function [-Werror=maybe-uninitialized]
sound/pci/hda/patch_hdmi.c:2526:19: note: 'jack' was declared here
This uses a compile-time check to avoid calling a nonworking
snd_jack_new() function, and sets an explicit NULL pointer instead.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 788d441a164c ("ALSA: hda - Use component ops for i915 HDMI/DP audio jack handling")
---
sound/pci/hda/patch_hdmi.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index f4443b5fbf6e..c0872ad80aa0 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -2526,6 +2526,11 @@ static int add_hdmi_jack_kctl(struct hda_codec *codec,
struct snd_jack *jack;
int err;
+ if (!IS_ENABLED(CONFIG_SND_JACK)) {
+ spec->pcm_rec[pcm_idx].jack = NULL;
+ return 0;
+ }
+
err = snd_jack_new(codec->card, name, SND_JACK_AVOUT, &jack,
true, false);
if (err < 0)
--
2.7.0
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Arnd Bergmann <arnd@arndb.de> - 2016-02-16 15:50 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Takashi Iwai <tiwai@suse.de> - 2016-02-16 16:50 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Arnd Bergmann <arnd@arndb.de> - 2016-02-16 17:20 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Takashi Iwai <tiwai@suse.de> - 2016-02-16 17:20 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Mark Brown <broonie@kernel.org> - 2016-02-16 17:40 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Takashi Iwai <tiwai@suse.de> - 2016-02-16 17:50 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Arnd Bergmann <arnd@arndb.de> - 2016-02-16 18:00 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Arnd Bergmann <arnd@arndb.de> - 2016-02-16 18:20 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Takashi Iwai <tiwai@suse.de> - 2016-02-16 18:20 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Arnd Bergmann <arnd@arndb.de> - 2016-02-16 18:30 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Arnd Bergmann <arnd@arndb.de> - 2016-02-16 23:10 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Takashi Iwai <tiwai@suse.de> - 2016-02-17 10:10 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Takashi Iwai <tiwai@suse.de> - 2016-02-17 10:40 +0100
Re: [PATCH] sound: hdmi: avoid dereferencing uninitialized 'jack' pointer Arnd Bergmann <arnd@arndb.de> - 2016-02-17 10:50 +0100
csiph-web