# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#                  ChangeSet    1.660.1.9 -> 1.660.1.10
#       drivers/usb/host/ohci-mem.c     1.8     -> 1.9    
#       drivers/usb/host/ohci-q.c       1.23    -> 1.24   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/09/30      [EMAIL PROTECTED]     1.660.1.10
# [PATCH] ohci-hcd, paranoia
# 
# In a test where some memory corruption happened, I noticed an
# oops (null pointer exception in_irq) that's avoidable.  Here's
# a patch that avoids it ... anyone seeing the err() is likely
# to hang some process, but that's better than the alternative.
# (Also inlines some used-once routines, saving a bit of space
# to make up for the new diagnostic.)
# --------------------------------------------
#
diff -Nru a/drivers/usb/host/ohci-mem.c b/drivers/usb/host/ohci-mem.c
--- a/drivers/usb/host/ohci-mem.c       Mon Sep 30 17:24:23 2002
+++ b/drivers/usb/host/ohci-mem.c       Mon Sep 30 17:24:23 2002
@@ -48,10 +48,10 @@
        struct hash_t * scan = entry->head;
        while (scan && scan->dma != dma)
                scan = scan->next;
-       return scan->virt;
+       return scan ? scan->virt : 0;
 }
 
-static struct td *
+static inline struct td *
 dma_to_td (struct ohci_hcd *hc, dma_addr_t td_dma)
 {
        td_dma &= TD_MASK;
@@ -62,7 +62,7 @@
 // FIXME:  when updating the hashtables this way, mem_flags is unusable...
 
 /* Add a hash entry for a TD/ED; return true on success */
-static int
+static inline int
 hash_add_ed_td (
        struct hash_list_t *entry,
        void *virt,
@@ -97,7 +97,7 @@
 }
 
 
-static void
+static inline void
 hash_free_ed_td (struct hash_list_t *entry, void *virt)
 {
        struct hash_t *scan, *prev;
diff -Nru a/drivers/usb/host/ohci-q.c b/drivers/usb/host/ohci-q.c
--- a/drivers/usb/host/ohci-q.c Mon Sep 30 17:24:23 2002
+++ b/drivers/usb/host/ohci-q.c Mon Sep 30 17:24:23 2002
@@ -854,6 +854,11 @@
                int             cc;
 
                td = dma_to_td (ohci, td_dma);
+               if (!td) {
+                       err ("%s bad entry %8x",
+                               ohci->hcd.self.bus_name, td_dma);
+                       break;
+               }
 
                td->hwINFO |= cpu_to_le32 (TD_DONE);
                cc = TD_CC_GET (le32_to_cpup (&td->hwINFO));


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to