[lkml]   [2022]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH] parport_pc: Avoid FIFO port location truncation
Match the data type of a temporary holding a reference to the FIFO port 
with the type of the original reference coming from `struct parport',
avoiding data truncation with LP64 ports such as SPARC64 that refer to
PCI port I/O locations via their corresponding MMIO addresses and will
therefore have non-zero bits in the high 32-bit part of the reference.
And in any case it is cleaner to have the data types matching here.

Signed-off-by: Maciej W. Rozycki <>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")

Found by code inspection in tracking down the cause of an oops; cf.
Credit to Bjorn for the details of the SPARC64 peculiarity.

I guess nobody has actually ever used a PCI parallel port with a SPARC64
machine, so it's probably not worth backporting, but I have chosen to add
a `Fixes' tag regardless for tracking, statistics, or whatever it might be
useful for, even though the offending temporary has been added long before
our GIT history (with or around Linux 2.3.10 AFAICT).

drivers/parport/parport_pc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-macro/drivers/parport/parport_pc.c
--- linux-macro.orig/drivers/parport/parport_pc.c
+++ linux-macro/drivers/parport/parport_pc.c
@@ -468,7 +468,7 @@ static size_t parport_pc_fifo_write_bloc
const unsigned char *bufp = buf;
size_t left = length;
unsigned long expire = jiffies + port->physport->cad->timeout;
- const int fifo = FIFO(port);
+ const unsigned long fifo = FIFO(port);
int poll_for = 8; /* 80 usecs */
const struct parport_pc_private *priv = port->physport->private_data;
const int fifo_depth = priv->fifo_depth;
 \ /
  Last update: 2022-09-23 20:52    [W:0.056 / U:0.100 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site