public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] V4L/DVB (11380): kzalloc failure ignored in au8522_probe()
@ 2009-09-18 23:11 Roel Kluin
  0 siblings, 0 replies; only message in thread
From: Roel Kluin @ 2009-09-18 23:11 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, linux-media, Andrew Morton

Prevent NULL dereference if kzalloc() fails.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
Found with sed: http://kernelnewbies.org/roelkluin

Build tested.

diff --git a/drivers/media/dvb/frontends/au8522_decoder.c b/drivers/media/dvb/frontends/au8522_decoder.c
index 9e9a755..74981ee 100644
--- a/drivers/media/dvb/frontends/au8522_decoder.c
+++ b/drivers/media/dvb/frontends/au8522_decoder.c
@@ -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;

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2009-09-18 23:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-18 23:11 [PATCH] V4L/DVB (11380): kzalloc failure ignored in au8522_probe() Roel Kluin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox