Skip to contentSkip to conversation

Overrun in drivers/char/rio/riocmd.c

PATCH New Eric Sesterhenn 1 participant 1 message Jun 21, 2006 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Overrun in drivers/char/rio/riocmd.c

hi,

this fixes coverity bug id #1025.
The code checks if Rup is greater or equal to the size of HostP->Mapping[], but uses Rup as an index if it is outside the range. This patch changes the if and else cases.

drivers/char/rio/riocmd.c renamed from drivers/char/rio/riocmd.c.orig +1 -1
@@ -402,7 +402,7 @@ static int RIOCommandRup(struct rio_info
 		rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Host number %Zd, name ``%s''\n", HostP - p->RIOHosts, HostP->Name);
 		rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: Rup number  0x%x\n", rup);
 
-		if (Rup >= (unsigned short) MAX_RUP) {
+		if (Rup < (unsigned short) MAX_RUP) {
 			rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for RTA ``%s''\n", HostP->Mapping[Rup].Name);
 		} else
 			rio_dprintk(RIO_DEBUG_CMD, "CONTROL information: This is the RUP for link ``%c'' of host ``%s''\n", ('A' + Rup - MAX_RUP), HostP->Name);