public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] [media] em28xx-input: NULL dereference on error
@ 2014-09-25 11:39 Dan Carpenter
  2014-09-25 14:08 ` Frank Schäfer
  0 siblings, 1 reply; 6+ messages in thread
From: Dan Carpenter @ 2014-09-25 11:39 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Frank Schaefer; +Cc: linux-media, kernel-janitors

We call "kfree(ir->i2c_client);" in the error handling and that doesn't
work if "ir" is NULL.

Fixes: 78e719a5f30b ('[media] em28xx-input: i2c IR decoders: improve i2c_client handling')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c
index 581f6da..23f8f6a 100644
--- a/drivers/media/usb/em28xx/em28xx-input.c
+++ b/drivers/media/usb/em28xx/em28xx-input.c
@@ -712,8 +712,10 @@ static int em28xx_ir_init(struct em28xx *dev)
 	em28xx_info("Registering input extension\n");
 
 	ir = kzalloc(sizeof(*ir), GFP_KERNEL);
+	if (!ir)
+		return -ENOMEM;
 	rc = rc_allocate_device();
-	if (!ir || !rc)
+	if (!rc)
 		goto error;
 
 	/* record handles to ourself */

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-09-25 17:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-25 11:39 [patch] [media] em28xx-input: NULL dereference on error Dan Carpenter
2014-09-25 14:08 ` Frank Schäfer
2014-09-25 14:49   ` Dan Carpenter
2014-09-25 17:50     ` Frank Schäfer
2014-09-25 15:37   ` Julia Lawall
2014-09-25 16:28     ` Mauro Carvalho Chehab

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