drivers/char/specialix.c: broken baud conversion

From: Adrian Bunk
Date: Sun Oct 08 2006 - 18:18:40 EST


Hi Alan,

your commit commit 67cc0161ecc9ebee6eba4af6cbfdba028090b1b9
"specialix - remove private speed decoding" converted the variable baud
from an index in the array baud_table[] to containing the baud value
itself.

Unfortunately, it contains at least two bugs:


The Coverity checker spotted that the following line was forgotten:

baud = (baud_table[baud] + 5) / 10; /* Estimated CPS */

BTW: After the trivial fix, baud_table[] could be removed.


While looking at the patch, I noticed it contains another bug that is
not that easy to fix:

- if (baud == 15) {
+ if (baud == 38400) {
if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_HI)
baud ++;
if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_VHI)
baud += 2;
}

Increasing the index for baud_table[] by 1 or 2 is quite different from
increasing baud by 1 or 2.


cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/