Skip to contentSkip to conversation

tty: mxser: forever loops on error

PATCH In review Dan Carpenter 2 participants 3 messages Apr 9, 2013

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

PATCH 1/1 tty: mxser: forever loops on error

There were a couple signedness bugs decrementing "i" which would lead to a forever loops.

I've made a couple other variables signed as well because they are all related array offsets and it would be weird if they weren't the same type.

drivers/tty/mxser.c +2 -2
index d996038..a095859 100644
@@ -2556,9 +2556,9 @@ static int mxser_probe(struct pci_dev *pdev,
 {
 #ifdef CONFIG_PCI
 	struct mxser_board *brd;
-	unsigned int i, j;
 	unsigned long ioaddress;
 	struct device *tty_dev;
+	int i, j;
 	int retval = -EINVAL;
 
 	for (i = 0; i < MXSER_BOARDS; i++)
@@ -2700,7 +2700,7 @@ static int __init mxser_module_init(void)
 {
 	struct mxser_board *brd;
 	struct device *tty_dev;
-	unsigned int b, i, m;
+	int b, i, m;
 	int retval;
 
 	mxvar_sdriver = alloc_tty_driver(MXSER_PORTS + 1);
#1 lore raw

Hi Dan,

Thank you for the patch.

We are also trying to fix the issue:
https://lkml.org/lkml/2013/2/19/29
https://lkml.org/lkml/2013/4/8/55

and the fix is finally in Greg's tty git tree since yesterday:
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
(tty-linus branch).

Best regards,
Alexey

Quoted 34 lines · Dan Carpenter

There were a couple signedness bugs decrementing "i" which would lead to a forever loops.

I've made a couple other variables signed as well because they are all related array offsets and it would be weird if they weren't the same type.

drivers/tty/mxser.c +2 -2
index d996038..a095859 100644
@@ -2556,9 +2556,9 @@ static int mxser_probe(struct pci_dev *pdev,
 {
 #ifdef CONFIG_PCI
 	struct mxser_board *brd;
-	unsigned int i, j;
 	unsigned long ioaddress;
 	struct device *tty_dev;
+	int i, j;
 	int retval = -EINVAL;
 
 	for (i = 0; i < MXSER_BOARDS; i++)
@@ -2700,7 +2700,7 @@ static int __init mxser_module_init(void)
 {
 	struct mxser_board *brd;
 	struct device *tty_dev;
-	unsigned int b, i, m;
+	int b, i, m;
 	int retval;
 
 	mxvar_sdriver = alloc_tty_driver(MXSER_PORTS + 1);
#2 lore raw
Quoted 4 lines · Alexey Khoroshilov

Hi Dan,

Thank you for the patch.

Quoted 8 lines

We are also trying to fix the issue:
https://lkml.org/lkml/2013/2/19/29
https://lkml.org/lkml/2013/4/8/55

and the fix is finally in Greg's tty git tree since yesterday:
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git
(tty-linus branch).

Good deal.

Btw, by the time that Fenguang's kbuild scripts emailed you, it was already too late to send a v2 patch.

regards,
dan carpenter