Skip to contentSkip to conversation

serial: cast before shifting on port io

PATCH New Alan Cox 1 participant 1 message Nov 6, 2012 TTY layer and serial drivers

lore
Share & tools
lore

Alan Cox

author
#0 lore raw

PATCH 1/1 serial: cast before shifting on port io

From: Alan Cox <[email protected]>

Without this we will shift data into oblivion and give wrong results on some configurations

---

 drivers/tty/serial/serial_core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/serial_core.c +1 -1
index 31af2a4..b2b77fd 100644
@@ -2409,7 +2409,7 @@ static ssize_t uart_get_attr_port(struct device *dev,
 	struct tty_port *port = dev_get_drvdata(dev);
 
 	uart_get_info(port, &tmp);
-	return snprintf(buf, PAGE_SIZE, "0x%lX\n", (unsigned long)(tmp.port | (tmp.port_high << HIGH_BITS_OFFSET)));
+	return snprintf(buf, PAGE_SIZE, "0x%lX\n", (unsigned long)(tmp.port | (((unsigned long)tmp.port_high) << HIGH_BITS_OFFSET)));
 }
 
 static ssize_t uart_get_attr_irq(struct device *dev,