From nobody Mon Feb 9 21:37:13 2026 Received: from smtp80.ord1d.emailsrvr.com (smtp80.ord1d.emailsrvr.com [184.106.54.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 800D3387367 for ; Fri, 30 Jan 2026 17:05:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.80 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792719; cv=none; b=CKVVeECTX9ndXVvOmpeAQQwiDesjA8zVjRUxE2qVzD4XG98x4YCgHH5C+Rb2zgMeIFO2lMutGsS0earolOu55UU8LiZK2aFTlCn28qqgo99WoGgBhyMqf2mcBktaJzXaaODO631jeJTMWaReQODxu1Od0kMFBINh6GDZFiiJNSI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792719; c=relaxed/simple; bh=HUIAyIzkIiLtPGhQ7ZiX3TA06XdUNUa3Y3g+LnL/HOg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=D4mSa50lEDrD9Ly5Zxj9wYDi7whzgv/i6+In/e0n5aVBF4ZNXvGQm/sCCMe+Jbyn48Xz3l3v96DUMVUyi9ZLLZ7f0I5XR83JqGZAHTzLdstSW8pJTAgUUUgVFJI0PUViWnZH8nAYHETvzvCowP84ZWFMc6ardpDBqzY0hAG6D/0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mev.co.uk; spf=pass smtp.mailfrom=mev.co.uk; dkim=pass (1024-bit key) header.d=mev.co.uk header.i=@mev.co.uk header.b=MNAvurX4; arc=none smtp.client-ip=184.106.54.80 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mev.co.uk Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mev.co.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mev.co.uk header.i=@mev.co.uk header.b="MNAvurX4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792717; bh=HUIAyIzkIiLtPGhQ7ZiX3TA06XdUNUa3Y3g+LnL/HOg=; h=From:To:Subject:Date:From; b=MNAvurX4LlLEbQsja+cFQmpqC8jr+JmXTyCqiUj90rENJKk9aGk7tLoHLmgXKCqp7 vA0mJAHFAmyffoRm/4KoWG1+RlW4pyUHfXgdtQW/zfqbZ0z6ZHEZ79ox+3Hea5QyGr BjuSvQcYJ6g5eSMuIf5qHhqaARQOuV0S+MB0bzlE= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 19225602FB; Fri, 30 Jan 2026 12:05:16 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 43/46] comedi: pcmuio: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:48:08 +0000 Message-ID: <20260130170416.49994-44-abbotti@mev.co.uk> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260130170416.49994-1-abbotti@mev.co.uk> References: <20260130170416.49994-1-abbotti@mev.co.uk> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Classification-ID: 429d5722-7f90-4557-8586-08913fa85e9e-44-1 Content-Type: text/plain; charset="utf-8" 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 --- drivers/comedi/drivers/pcmuio.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/comedi/drivers/pcmuio.c b/drivers/comedi/drivers/pcmui= o.c index 33b24dbbb919..0995911a3ea3 100644 --- a/drivers/comedi/drivers/pcmuio.c +++ b/drivers/comedi/drivers/pcmuio.c @@ -521,11 +521,12 @@ static int pcmuio_attach(struct comedi_device *dev, s= truct comedi_devconfig *it) const struct pcmuio_board *board =3D dev->board_ptr; struct comedi_subdevice *s; struct pcmuio_private *devpriv; + unsigned int io_len =3D board->num_asics * PCMUIO_ASIC_IOSIZE; int ret; int i; =20 - ret =3D comedi_request_region(dev, it->options[0], - board->num_asics * PCMUIO_ASIC_IOSIZE); + ret =3D comedi_check_request_region(dev, it->options[0], io_len, + 0, 0xffff, io_len); if (ret) return ret; =20 --=20 2.51.0