Skip to contentSkip to conversation

Off by one in drivers/usb/serial/usb-serial.c

PATCH New Eric Sesterhenn 1 participant 1 message Jun 21, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Off by one in drivers/usb/serial/usb-serial.c

hi,

this fixes coverity id #554. since serial table
is defines as serial_table[SERIAL_TTY_MINORS] we
should make sure we dont acess with an index
of SERIAL_TTY_MINORS.

drivers/usb/serial/usb-serial.c renamed from drivers/usb/serial/usb-serial.c.orig +1 -1
@@ -83,7 +83,7 @@ static struct usb_serial *get_free_seria
 
 		good_spot = 1;
 		for (j = 1; j <= num_ports-1; ++j)
-			if ((i+j >= SERIAL_TTY_MINORS) || (serial_table[i+j])) {
+			if ((i+j >= SERIAL_TTY_MINORS-1)||(serial_table[i+j])) {
 				good_spot = 0;
 				i += j;
 				break;