rc/redrat3: dereferencing null pointer

Message ID 20110526085508.GG14591@shale.localdomain (mailing list archive)
State Superseded, archived
Headers

Commit Message

Dan Carpenter May 26, 2011, 8:55 a.m. UTC
  In the original code, if the allocation failed we dereference "rr3"
when it was NULL.

Signed-off-by: Dan Carpenter <error27@gmail.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Comments

Jarod Wilson May 26, 2011, 2:51 p.m. UTC | #1
Dan Carpenter wrote:
> In the original code, if the allocation failed we dereference "rr3"
> when it was NULL.

D'oh, yeah, thanks for the fix.

Acked-by: Jarod Wilson <jarod@redhat.com>
  

Patch

diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
index 5147767..4582ef7 100644
--- a/drivers/media/rc/redrat3.c
+++ b/drivers/media/rc/redrat3.c
@@ -1186,7 +1186,7 @@  static int __devinit redrat3_dev_probe(struct usb_interface *intf,
 	rr3 = kzalloc(sizeof(*rr3), GFP_KERNEL);
 	if (rr3 == NULL) {
 		dev_err(dev, "Memory allocation failure\n");
-		goto error;
+		goto no_endpoints;
 	}
 
 	rr3->dev = &intf->dev;