Skip to contentSkip to conversation

fix for buggy variable reuse in riotable.c (244ac18)

PATCH New Rasmus Andersen 1 participant 1 message May 27, 2001 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix for buggy variable reuse in riotable.c (244ac18)

Forgot l-k when sending this off...

----- Forwarded message from Rasmus Andersen <[email protected]> -----

Hi.

The following patch fixes a buggy variable reuse i drivers/char/ rio/riotable.c (244-ac18) as reported by the stanford team way back.

drivers/char/rio/riotable.c +7 -7
@@ -501,7 +501,7 @@
 	struct Map *HostMapP;
 	struct Port *PortP;
 	int work_done = 0;
-	unsigned long flags;
+	unsigned long lock_flags, sem_flags;
 
 	rio_dprintk (RIO_DEBUG_TABLE, "Delete entry on host %x, rta %x\n",
 								MapP->HostUniqueNum, MapP->RtaUniqueNum);
@@ -509,10 +509,10 @@
 	for ( host=0; host < p->RIONumHosts; host++ ) {
 		HostP = &p->RIOHosts[host];
 
-		rio_spin_lock_irqsave( &HostP->HostLock, flags );
+		rio_spin_lock_irqsave( &HostP->HostLock, lock_flags );
 
 		if ( (HostP->Flags & RUN_STATE) != RC_RUNNING ) {
-			rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
+			rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags);
 			continue;
 		}
 
@@ -529,7 +529,7 @@
 					if ( HostMapP->Topology[link].Unit != ROUTE_DISCONNECT ) {
 						rio_dprintk (RIO_DEBUG_TABLE, "Entry is in use and cannot be deleted!\n");
 						p->RIOError.Error = UNIT_IS_IN_USE;
-						rio_spin_unlock_irqrestore( &HostP->HostLock, flags);
+						rio_spin_unlock_irqrestore( &HostP->HostLock, lock_flags);
 						return EBUSY;
 					}
 				}
@@ -544,7 +544,7 @@
 						PortP = p->RIOPortp[port];
 						rio_dprintk (RIO_DEBUG_TABLE, "Unmap port\n");
 
-						rio_spin_lock_irqsave( &PortP->portSem, flags );
+						rio_spin_lock_irqsave( &PortP->portSem, sem_flags );
 
 						PortP->Mapped = 0;
 
@@ -602,7 +602,7 @@
 							WWORD(PortP->PhbP->destination,
 							 dest_unit + (dest_port << 8));
 						}
-						rio_spin_unlock_irqrestore(&PortP->portSem, flags);
+						rio_spin_unlock_irqrestore(&PortP->portSem, sem_flags);
 					}
 				}
 				rio_dprintk (RIO_DEBUG_TABLE, "Entry nulled.\n");
@@ -610,7 +610,7 @@
 				work_done++;
 			}
 		}
-		rio_spin_unlock_irqrestore(&HostP->HostLock, flags);
+		rio_spin_unlock_irqrestore(&HostP->HostLock, lock_flags);
 	}
 
 	/* XXXXX lock me up */
Signature · 7 lines
Regards,
        Rasmus([email protected])

We're going to turn this team around 360 degrees.
-Jason Kidd, upon his drafting to the Dallas Mavericks

----- End forwarded message -----