All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix a potential NULL pointer dereference in usbat_check_status() in drivers/usb/storage/shuttle_usbat.c
@ 2007-09-04  8:25 Micah Gruber
  2007-09-04 11:06 ` Jens Axboe
  0 siblings, 1 reply; 7+ messages in thread
From: Micah Gruber @ 2007-09-04  8:25 UTC (permalink / raw)
  To: linux-kernel, linux-usb-devel, gregkh

This patch fixes a potential null dereference bug where we dereference us before a null check. This patch simply moves the dereferencing after the null check.

Signed-off-by: Micah Gruber <micah.gruber@gmail.com>
---

--- a/drivers/usb/storage/shuttle_usbat.c
+++ b/drivers/usb/storage/shuttle_usbat.c
@@ -187,12 +187,14 @@
  */
 static int usbat_check_status(struct us_data *us)
 {
-	unsigned char *reply = us->iobuf;
+	unsigned char *reply;
 	int rc;
 
 	if (!us)
 		return USB_STOR_TRANSPORT_ERROR;
 
+	reply = us->iobuf;
+
 	rc = usbat_get_status(us, reply);
 	if (rc != USB_STOR_XFER_GOOD)
 		return USB_STOR_TRANSPORT_FAILED;


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

end of thread, other threads:[~2007-09-10 16:33 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-04  8:25 [PATCH] Fix a potential NULL pointer dereference in usbat_check_status() in drivers/usb/storage/shuttle_usbat.c Micah Gruber
2007-09-04 11:06 ` Jens Axboe
2007-09-04 19:57   ` Simon Holm Thøgersen
2007-09-04 20:58     ` [linux-usb-devel] " Alan Stern
2007-09-04 21:06     ` Jens Axboe
2007-09-06 22:33       ` [PATCH] Remove pointless NULL pointer check " Simon Holm Thøgersen
2007-09-10 16:33         ` Jens Axboe

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.