Skip to contentSkip to conversation

V4L/DVB (11380): kzalloc failure ignored in au8522_probe()

PATCH New Roel Kluin 1 participant 1 message Sep 18, 2009 Media (V4L/DVB)

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 V4L/DVB (11380): kzalloc failure ignored in au8522_probe()

Prevent NULL dereference if kzalloc() fails.

---
Found with sed: http://kernelnewbies.org/roelkluin

Build tested.

drivers/media/dvb/frontends/au8522_decoder.c +5 -0
index 9e9a755..74981ee 100644
@@ -792,6 +792,11 @@ static int au8522_probe(struct i2c_client *client,
 	}
 
 	demod_config = kzalloc(sizeof(struct au8522_config), GFP_KERNEL);
+	if (demod_config == NULL) {
+		if (instance == 1)
+			kfree(state);
+		return -ENOMEM;
+	}
 	demod_config->demod_address = 0x8e >> 1;
 
 	state->config = demod_config;