Bug 14238

Summary: found a possible null pointer dereference in file linux-2.6.31/sound/soc/soc-jack.c
Product: Drivers Reporter: Martin Ettl (ettl.martin)
Component: Sound(OSS)Assignee: drivers_sound
Status: CLOSED CODE_FIX    
Severity: normal CC: alan
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.31 Subsystem:
Regression: No Bisected commit-id:

Description Martin Ettl 2009-09-26 17:09:17 UTC
Hello,

i have checked the linux kernel with the static code analysis tool cppcheck. It found a possible nullpointer dereference in file linux-2.6.31/sound/soc/soc-jack.c
at line 61. 

Take a look at the code:

void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
{
61	struct snd_soc_codec *codec = jack->card->codec;
	struct snd_soc_jack_pin *pin;
	int enable;
	int oldstatus;

66	if (!jack) {
		WARN_ON_ONCE(!jack);
		return;
	}
....

Indeed, the pointer 'jack' is used at line 61. Then at line 66 it is checked for NULL.

Best regards

Martin