svn commit: r197558 - head/sys/dev/usb

Andrew Thompson thompsa at FreeBSD.org
Mon Sep 28 07:39:53 UTC 2009


Author: thompsa
Date: Mon Sep 28 07:39:51 2009
New Revision: 197558
URL: http://svn.freebsd.org/changeset/base/197558

Log:
  Fix NULL-pointer dereference in usb_endpoint_foreach().
  
  PR:		usb/138389
  Submitted by:	Patroklos Argyroudis at census, inc

Modified:
  head/sys/dev/usb/usb_device.c

Modified: head/sys/dev/usb/usb_device.c
==============================================================================
--- head/sys/dev/usb/usb_device.c	Mon Sep 28 07:32:11 2009	(r197557)
+++ head/sys/dev/usb/usb_device.c	Mon Sep 28 07:39:51 2009	(r197558)
@@ -367,12 +367,14 @@ usb_init_endpoint(struct usb_device *ude
 struct usb_endpoint *
 usb_endpoint_foreach(struct usb_device *udev, struct usb_endpoint *ep)
 {
-	struct usb_endpoint *ep_end = udev->endpoints + udev->endpoints_max;
+	struct usb_endpoint *ep_end;
 
 	/* be NULL safe */
 	if (udev == NULL)
 		return (NULL);
 
+	ep_end = udev->endpoints + udev->endpoints_max;
+
 	/* get next endpoint */
 	if (ep == NULL)
 		ep = udev->endpoints;


More information about the svn-src-head mailing list