Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

comedi: pcmuio: Add sanity checks for I/O base address

The "pcmmio" driver uses an admin-supplied configuration option
(`it->options[0]`) to configure the I/O port base address of a
PCM-UIO48A or PCM-UIO96A board. It will probably work with the later
PCM-UIO48C and PCM-UIO96C boards. It currently allows any base address
to be configured but the hardware only supports base addresses
(configured by on-board jumpers) in the range 0 to 0xFFF0 on 16-byte
boundaries (for PCM-UIO48C) or 0 to 0xFFE0 on 32-byte boundaries (for
PCM-UIO96C). (The PCM-UIO48A supports base addresses up to 0xFF0 and
the PCI-UIO96A supports base addresses up to 0x7E0.)

Add a sanity check to ensure the device is not configured at an
unsupported base address (allowing for the extended range of the "C"
models).

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Link: https://patch.msgid.link/20260130170416.49994-44-abbotti@mev.co.uk
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ian Abbott and committed by
Greg Kroah-Hartman
3d4ab548 78ba300a

+3 -2
+3 -2
drivers/comedi/drivers/pcmuio.c
··· 521 521 const struct pcmuio_board *board = dev->board_ptr; 522 522 struct comedi_subdevice *s; 523 523 struct pcmuio_private *devpriv; 524 + unsigned int io_len = board->num_asics * PCMUIO_ASIC_IOSIZE; 524 525 int ret; 525 526 int i; 526 527 527 - ret = comedi_request_region(dev, it->options[0], 528 - board->num_asics * PCMUIO_ASIC_IOSIZE); 528 + ret = comedi_check_request_region(dev, it->options[0], io_len, 529 + 0, 0xffff, io_len); 529 530 if (ret) 530 531 return ret; 531 532