All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: gspaca: check pointer against NULL before using it in create_urbs()
@ 2014-01-07  9:56 Ethan Zhao
  2014-01-10 13:07 ` Hans Verkuil
  0 siblings, 1 reply; 3+ messages in thread
From: Ethan Zhao @ 2014-01-07  9:56 UTC (permalink / raw)
  To: hans.verkuil, m.chehab, gregkh; +Cc: linux-kernel, Ethan Zhao

function alt_xfer() may return NULL, should check its return value passed into
create_urbs() as parameter.

gspca_init_transfer()
{
... ...
ret = create_urbs(gspca_dev,alt_xfer(&intf->altsetting[alt], xfer));
... ...
}

Signed-off-by: Ethan Zhao <ethan.kernel@gmail.com>
---
 drivers/media/usb/gspca/gspca.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/usb/gspca/gspca.c b/drivers/media/usb/gspca/gspca.c
index 048507b..eb45bc0 100644
--- a/drivers/media/usb/gspca/gspca.c
+++ b/drivers/media/usb/gspca/gspca.c
@@ -761,6 +761,8 @@ static int create_urbs(struct gspca_dev *gspca_dev,
 	struct urb *urb;
 	int n, nurbs, i, psize, npkt, bsize;
 
+	if (!ep)
+		return -EINVAL;
 	/* calculate the packet size and the number of packets */
 	psize = le16_to_cpu(ep->desc.wMaxPacketSize);
 
-- 
1.8.3.4 (Apple Git-47)


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

end of thread, other threads:[~2014-01-10 15:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-07  9:56 [PATCH] media: gspaca: check pointer against NULL before using it in create_urbs() Ethan Zhao
2014-01-10 13:07 ` Hans Verkuil
2014-01-10 15:01   ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.