From nobody Sun Feb 8 13:45:03 2026 Received: from smtp87.ord1d.emailsrvr.com (smtp87.ord1d.emailsrvr.com [184.106.54.87]) (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 DD21E34FF76 for ; Fri, 30 Jan 2026 17:11:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.87 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793109; cv=none; b=uFgHyKNhocMx3T7GVWEhfRN8YzoKKwRRGAT+fWgYNHWmDMkD+VL7VPYE7VBceql/YQYltszH4OzDpvm4DMvmIqvA+tuLGv1gJ5UilPjXWQImWm/XT7ZCxFQCeYt3f04Tu9ymggkKteqbuUuthW9/u2VJrfQ3XC8R3wbuJtwS74g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793109; c=relaxed/simple; bh=o7Kr1ev9rp6owAG+m3KziWoFMj+bZpI5Cj9v0MokCZY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PLcdInrjnHLrWf3rFaZNq+PenO5mDfVY0BrJHnbnAAiqgI6smDTTvzLJc367OxqrrJBkAAadZdvGn8jQTUvuHtMMXqI6ufCuMuQy+MPmZ8M1ZGOt38FnRMy3kDBusjDHLhRFwuMbbDCqlOMGm7rhyfeR8cVfIbLC+bNi5vUs5A8= 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=HSqmFH5v; arc=none smtp.client-ip=184.106.54.87 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="HSqmFH5v" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792671; bh=o7Kr1ev9rp6owAG+m3KziWoFMj+bZpI5Cj9v0MokCZY=; h=From:To:Subject:Date:From; b=HSqmFH5vCrDdn7je944L4d662ivgpSiip2n6wt7uQQL6mo1kKSlh5eh/z7ZU7UOvg hsusMEHEuCRJ81iEAk4a5zIFUwzsz2mWoWKPPNfAAbQovC2J2TNL/qp+1TjwYhdQ/v XBvIjZL+C8TWvQ4WNujZ+ZWd/njAp0MGwUmv2xCA= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 32BEF602CF; Fri, 30 Jan 2026 12:04:31 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 01/46] comedi: add comedi_check_request_region() Date: Fri, 30 Jan 2026 16:47:26 +0000 Message-ID: <20260130170416.49994-2-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-2-1 Content-Type: text/plain; charset="utf-8" There is an existing comedi_request_region(dev, start, len) function used by COMEDI drivers for legacy devices to request an I/O port region starting at a specified base address (which must be non-zero) and with a specified length. It uses request_region(). On success, it sets dev->iobase and dev->iolen and returns 0. There is a alternative function __comedi_request_region(dev, start, len) which does the same thing without setting dev->iobase and dev->iolen. Most hardware devices have restrictions on the allowed I/O port base address and alignment, so add new functions comedi_check_request_region(dev, start, len, minstart, maxend, minalign) and __comedi_check_request_region(dev, start, len, minstart, maxend, minalign) to perform these additional checks. Turn the original functions into static inline wrapper functions that call the new functions. Signed-off-by: Ian Abbott --- drivers/comedi/drivers.c | 46 ++++++++++++++++++++------- include/linux/comedi/comedidev.h | 53 +++++++++++++++++++++++++++++--- 2 files changed, 84 insertions(+), 15 deletions(-) diff --git a/drivers/comedi/drivers.c b/drivers/comedi/drivers.c index 69cd2a253c66..316cb510b89b 100644 --- a/drivers/comedi/drivers.c +++ b/drivers/comedi/drivers.c @@ -933,19 +933,24 @@ int comedi_load_firmware(struct comedi_device *dev, EXPORT_SYMBOL_GPL(comedi_load_firmware); =20 /** - * __comedi_request_region() - Request an I/O region for a legacy driver + * __comedi_check_request_region() - Request an I/O region for a legacy dr= iver * @dev: COMEDI device. * @start: Base address of the I/O region. * @len: Length of the I/O region. + * @minstart: Minimum allowed start address of region. + * @maxend: Maximum allowed region end address of region. + * @minalign: Required alignment for base address. * * Requests the specified I/O port region which must start at a non-zero - * address. + * address, must fall within specified bounds, and must be correctly align= ed. * * Returns 0 on success, -EINVAL if @start is 0, or -EIO if the request * fails. */ -int __comedi_request_region(struct comedi_device *dev, - unsigned long start, unsigned long len) +int __comedi_check_request_region(struct comedi_device *dev, + unsigned long start, unsigned long len, + unsigned long minstart, unsigned long maxend, + unsigned long minalign) { if (!start) { dev_warn(dev->class_dev, @@ -954,6 +959,19 @@ int __comedi_request_region(struct comedi_device *dev, return -EINVAL; } =20 + if (start < minstart || start > maxend || maxend - start < len - 1) { + dev_warn(dev->class_dev, + "%s: I/O base address or length out of range\n", + dev->board_name); + return -EINVAL; + } + if (!IS_ALIGNED(start, minalign)) { + dev_warn(dev->class_dev, + "%s: I/O base address not correctly aligned\n", + dev->board_name); + return -EINVAL; + } + if (!request_region(start, len, dev->board_name)) { dev_warn(dev->class_dev, "%s: I/O port conflict (%#lx,%lu)\n", dev->board_name, start, len); @@ -962,16 +980,19 @@ int __comedi_request_region(struct comedi_device *dev, =20 return 0; } -EXPORT_SYMBOL_GPL(__comedi_request_region); +EXPORT_SYMBOL_GPL(__comedi_check_request_region); =20 /** - * comedi_request_region() - Request an I/O region for a legacy driver + * comedi_check_request_region() - Request an I/O region for a legacy driv= er * @dev: COMEDI device. * @start: Base address of the I/O region. * @len: Length of the I/O region. + * @minstart: Minimum allowed start address of region. + * @maxend: Maximum allowed region end address of region. + * @minalign: Required alignment for base address. * * Requests the specified I/O port region which must start at a non-zero - * address. + * address, must fall within specified bounds, and must be correctly align= ed. * * On success, @dev->iobase is set to the base address of the region and * @dev->iolen is set to its length. @@ -979,12 +1000,15 @@ EXPORT_SYMBOL_GPL(__comedi_request_region); * Returns 0 on success, -EINVAL if @start is 0, or -EIO if the request * fails. */ -int comedi_request_region(struct comedi_device *dev, - unsigned long start, unsigned long len) +int comedi_check_request_region(struct comedi_device *dev, + unsigned long start, unsigned long len, + unsigned long minstart, unsigned long maxend, + unsigned long minalign) { int ret; =20 - ret =3D __comedi_request_region(dev, start, len); + ret =3D __comedi_check_request_region(dev, start, len, minstart, maxend, + minalign); if (ret =3D=3D 0) { dev->iobase =3D start; dev->iolen =3D len; @@ -992,7 +1016,7 @@ int comedi_request_region(struct comedi_device *dev, =20 return ret; } -EXPORT_SYMBOL_GPL(comedi_request_region); +EXPORT_SYMBOL_GPL(comedi_check_request_region); =20 /** * comedi_legacy_detach() - A generic (*detach) function for legacy drivers diff --git a/include/linux/comedi/comedidev.h b/include/linux/comedi/comedi= dev.h index 35fdc41845ce..577a08f37aee 100644 --- a/include/linux/comedi/comedidev.h +++ b/include/linux/comedi/comedidev.h @@ -1026,10 +1026,55 @@ int comedi_load_firmware(struct comedi_device *dev,= struct device *hw_dev, unsigned long context), unsigned long context); =20 -int __comedi_request_region(struct comedi_device *dev, - unsigned long start, unsigned long len); -int comedi_request_region(struct comedi_device *dev, - unsigned long start, unsigned long len); +int __comedi_check_request_region(struct comedi_device *dev, + unsigned long start, unsigned long len, + unsigned long minstart, unsigned long maxend, + unsigned long minalign); +int comedi_check_request_region(struct comedi_device *dev, + unsigned long start, unsigned long len, + unsigned long minstart, unsigned long maxend, + unsigned long minalign); + +/** + * __comedi_request_region() - Request an I/O region for a legacy driver + * @dev: COMEDI device. + * @start: Base address of the I/O region. + * @len: Length of the I/O region. + * + * Requests the specified I/O port region which must start at a non-zero + * address. + * + * Returns 0 on success, -EINVAL if @start is 0, or -EIO if the request + * fails. + */ +static inline int __comedi_request_region(struct comedi_device *dev, + unsigned long start, + unsigned long len) +{ + return __comedi_check_request_region(dev, start, len, 0, ~0ul, 1); +} + +/** + * comedi_request_region() - Request an I/O region for a legacy driver + * @dev: COMEDI device. + * @start: Base address of the I/O region. + * @len: Length of the I/O region. + * + * Requests the specified I/O port region which must start at a non-zero + * address. + * + * On success, @dev->iobase is set to the base address of the region and + * @dev->iolen is set to its length. + * + * Returns 0 on success, -EINVAL if @start is 0, or -EIO if the request + * fails. + */ +static inline int comedi_request_region(struct comedi_device *dev, + unsigned long start, unsigned long len) +{ + return comedi_check_request_region(dev, start, len, 0, ~0ul, 1); +} + void comedi_legacy_detach(struct comedi_device *dev); =20 int comedi_auto_config(struct device *hardware_device, --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp85.ord1d.emailsrvr.com (smtp85.ord1d.emailsrvr.com [184.106.54.85]) (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 DCFC2341660 for ; Fri, 30 Jan 2026 17:11:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.85 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793109; cv=none; b=gxeLTYwBCMzp6ajOJ/tB+R3ToGKYhzNWtufRUTnHYLUzT6YYHb1NPHYtRyihbCVNBME53uRdP/teabya/nzzT5oLzpWhsMRLDqDtZHmF/Lvz+aALn0Ns8tsWXGojvWfhqHoF8vrFelogK31znQm+08tRgFx7PHelksIz44uAZ44= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793109; c=relaxed/simple; bh=kvA7p+XyHKaMB2UvsSnq65o+jjv1uAVi7tml7HL5pyY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ywaf06a3ySHjf1v5EIgOwm0Zffj1MlWYR1qqpq3xoTz8/3P1vmJo+5W5GMN6BAAEHoxc4vH1jf/ZPW5L37SyqStb7Vd+k3VUGi402ZnnXXtAzY3UKoKSYxsuVLKdLvdv78TC1qXpdhr8JsGbYbq43K8UsOH/K0TewMcCzZfdJA0= 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=RggzKLUt; arc=none smtp.client-ip=184.106.54.85 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="RggzKLUt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792673; bh=kvA7p+XyHKaMB2UvsSnq65o+jjv1uAVi7tml7HL5pyY=; h=From:To:Subject:Date:From; b=RggzKLUtX4Xc+A82ZcNNE0iP4YJ7zJenwL0gnRuoWFxsu4uA3CZPrUstFKwl+zSFV 4+ZFSf8W0RAdcTekAcTELTk8nOeeSQ8LT5/yAnltQYm8tXs3bAw243re+uzE84GQ2H S3ke6PKjNO24bkdXHt8FTvET/JuV1289KC1nR8kI= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 4371E602B8; Fri, 30 Jan 2026 12:04:32 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 02/46] comedi: 8255: Add some I/O base address sanity checks Date: Fri, 30 Jan 2026 16:47:27 +0000 Message-ID: <20260130170416.49994-3-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-3-1 Content-Type: text/plain; charset="utf-8" The "8255" driver allows a COMEDI device to be constructed from one or more 8255 chips, each at an I/O port base address specified by the admin-supplied configuration options (`it->options[]`). Currently, the driver allows any I/O base addresses to be specified as long as the I/O regions can be reserved, and it converts the specified `int` option values holding the base address to `unsigned long`. It doesn't make sense to allow base addresses that are not aligned to 4-byte boundaries because the hardware register addresses would not be decoded properly, so add a check for valid alignment. Convert the option values that specify the base addresses from `int` to `unsigned int` instead of `unsigned long` so they end up the same on 32-bit and 64-bit systems. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/8255.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/comedi/drivers/8255.c b/drivers/comedi/drivers/8255.c index 5f70938b4477..ff45248ebb29 100644 --- a/drivers/comedi/drivers/8255.c +++ b/drivers/comedi/drivers/8255.c @@ -47,7 +47,7 @@ static int dev_8255_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; - unsigned long iobase; + unsigned int iobase; int ret; int i; =20 @@ -70,13 +70,15 @@ static int dev_8255_attach(struct comedi_device *dev, iobase =3D it->options[i]; =20 /* - * __comedi_request_region() does not set dev->iobase. + * __comedi_check_request_region() does not set dev->iobase. * * For 8255 devices that are manually attached using * comedi_config, the 'iobase' is the actual I/O port - * base address of the chip. + * base address of the chip. It should be aligned on + * a 4-byte boundary. */ - ret =3D __comedi_request_region(dev, iobase, I8255_SIZE); + ret =3D __comedi_check_request_region(dev, iobase, I8255_SIZE, + 0, UINT_MAX, 4); if (ret) return ret; ret =3D subdev_8255_io_init(dev, s, iobase); --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp85.ord1d.emailsrvr.com (smtp85.ord1d.emailsrvr.com [184.106.54.85]) (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 1509635B137 for ; Fri, 30 Jan 2026 17:11:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.85 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793111; cv=none; b=GwiYrjaG48WC+Agebw/YjTpluAUY9mEOViLB41Nle4PRaa/AgFS53DcqlFTlF7Cl1XPcMxiGENelmZcXTmRAR9p+ZpWJWaQ1XkWGapDFImuDUkUTRubvcZlQbwQ31Fbt0c6cIfsFdm6oDg3R2zJwc2eeGRoxYbvWjFE2whcYnfE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793111; c=relaxed/simple; bh=4FMayF8sez9NxhjDj0oLOlBlmzx4UVNe72Rk9NwXCCU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jzR0ZJbKEAEzws4bVJPfJhPY+FF7yNDO+Oy9kuQkBYKzyGFYSNeFjOvuLMgwFQKKvWv/f/CseEKzWg36MTRj7kgy0f4pvrL/4YiBhgsT0Xe66z81T45voq0mN//d7TJdmSKExjf/fwlQs+NU2jHhNRQ1PVxaTMhA25CChVNCwDk= 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=UsdHwjxC; arc=none smtp.client-ip=184.106.54.85 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="UsdHwjxC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792674; bh=4FMayF8sez9NxhjDj0oLOlBlmzx4UVNe72Rk9NwXCCU=; h=From:To:Subject:Date:From; b=UsdHwjxCY/jX4Xo3QrtezApxN9rsmpC+1uxjkagauAfQ/opGxn6mUGITGCZ1a5rbQ a2tDVSrmwkpemrdiZkWs4zMNiuE07dgtTSm1crs9bdwgneWn9j3ThsAtKm8g0N1nZZ q2P4ysYI8B7rvUJjBolnyiKuir458gVBhBHKHP8c= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 49734602DB; Fri, 30 Jan 2026 12:04:33 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 03/46] comedi: adq12b: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:28 +0000 Message-ID: <20260130170416.49994-4-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-4-1 Content-Type: text/plain; charset="utf-8" The "adq12b" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of the ADQ12-B board. It currently allows any base address to be configured but the hardware only supports the following base addresses (set by an on-board jumper): 0x300, 0x320, 0x340, 0x360, 0x380, 0x3A0. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/adq12b.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/adq12b.c b/drivers/comedi/drivers/adq12= b.c index 19d765182006..f8fa5c6ecdff 100644 --- a/drivers/comedi/drivers/adq12b.c +++ b/drivers/comedi/drivers/adq12b.c @@ -179,7 +179,8 @@ static int adq12b_attach(struct comedi_device *dev, str= uct comedi_devconfig *it) struct comedi_subdevice *s; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x10); + ret =3D comedi_check_request_region(dev, it->options[0], 0x10, + 0x300, 0x3af, 0x20); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 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 760F33502B3 for ; Fri, 30 Jan 2026 17:11:47 +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=1769793109; cv=none; b=YvZ7UwLTaFvkEfK1lpKM5+CbRoiy0BhZtx8VPAt5MXoDiLvW6MdTqIoQD22sxvPo6013T3a4NhAwui/cBtygdZComj+MoFAU/wHbK6EZa0u/cWTQyu79V/uXDMyzsmI2ZftPGbGT9PyANlloSHioPuIFWrvb5apg7aC/QyvIDuw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793109; c=relaxed/simple; bh=+Rff5K5qS4M4MT8VnzZt57TWKYaUtisccVsjKo75Sho=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U0gqrinvYsvRo3St1bhGYAn3oLX2bJoB/Q4R2Qlrl4n5P3qZNLdRLCSwxDcIHeCz6y/nU6W1oh7rw4lmHC+phCmsma/80OXUeYuFWHBbS46/t9qovO8CV8nrw+y0stcgtGqtjDRMVMU4z4CaWbtF6cp8qy7H/s1cPX2OM3Ag+YU= 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=o/b0/k1Y; 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="o/b0/k1Y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792675; bh=+Rff5K5qS4M4MT8VnzZt57TWKYaUtisccVsjKo75Sho=; h=From:To:Subject:Date:From; b=o/b0/k1YNH+G4TC8HIHdIGyjIZf5Vqy7FY7sQLpBeiXODs9EIL94Zmwc8HD6PV2Fc pIXNetxmUZK51wcs7+Lcl3+knGPDI4/5aCkVti84GETcnR1g9I6GT/4D09dAtIlk95 w2zDcr5k71PGTG7db/uD6mPc9kgwybgzGS5NwQfE= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 57FCB6029E; Fri, 30 Jan 2026 12:04:34 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 04/46] comedi: aio_aio12_8: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:29 +0000 Message-ID: <20260130170416.49994-5-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-5-1 Content-Type: text/plain; charset="utf-8" The "aio_aio12_8" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a supported board (AIO12-8, AI12-8, or AO12-4). It currently allows any base address to be configured but the hardware only supports base addresses (set by on-board jumpers) in the range 0x100 to 0x3C0 on 32-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/aio_aio12_8.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/aio_aio12_8.c b/drivers/comedi/drivers/= aio_aio12_8.c index 227a86a3a760..1d9e14981928 100644 --- a/drivers/comedi/drivers/aio_aio12_8.c +++ b/drivers/comedi/drivers/aio_aio12_8.c @@ -202,7 +202,8 @@ static int aio_aio12_8_attach(struct comedi_device *dev, struct comedi_subdevice *s; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 32); + ret =3D comedi_check_request_region(dev, it->options[0], 32, + 0x100, 0x3ff, 32); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp82.ord1d.emailsrvr.com (smtp82.ord1d.emailsrvr.com [184.106.54.82]) (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 AAD59322557 for ; Fri, 30 Jan 2026 17:11:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.82 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793108; cv=none; b=o6Z22/XILez1AdzvYBmXgWuTVZSCRzI3hNsoTnpgc2QXOW6fckWqFvV0hwzPqFO84Eej69vrixNw63BL6DSk90z3tygfLBRBcW0rK2h7+jXnRFicSm9O0APBVA9Pws3pWJ8QJuy1bbol9o6knCWlZKl8Ad8NwOPtm+ACm1RJjcI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793108; c=relaxed/simple; bh=KCQ+qUDuv4p6o1ap2mWPcrnMB1fgfuzLOzsWSIlvz6E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qvxgXQU1WyE8UtIXI35G7aDA5kZKACMeBMrPp0fpM1G1Fdj6Nxkq6QhXxC2xY4hO94NIUGSYgf2jiydFDXIaW89xDdJuvM24a94ObAjtS33cP9czTACnDosRPre4rIcKzry6Tklr4EUZuvJhOyyUgbH+kluR2BL8Bx2jQgtVhPY= 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=DRP21eNE; arc=none smtp.client-ip=184.106.54.82 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="DRP21eNE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792676; bh=KCQ+qUDuv4p6o1ap2mWPcrnMB1fgfuzLOzsWSIlvz6E=; h=From:To:Subject:Date:From; b=DRP21eNEgqH1pYb4oOPP2No+Vmqv/LnhX49FF5rz1PoGz5hgzwucRfKqahoaDn6KB /Q4dTZzDneupbkJyOfiXDphrvv2W/VZbr5XZTOXaBrPMMHuMkSoUGTwRkAmPJ9xnOE BfjCjH12/RBY3RO7c1dfEB6V6JFtmUC39LWDQgSc= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 5F1B3602D6; Fri, 30 Jan 2026 12:04:35 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 05/46] comedi: aio_iiro_16: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:30 +0000 Message-ID: <20260130170416.49994-6-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-6-1 Content-Type: text/plain; charset="utf-8" The "aio_iiro_16" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a supported board (IIRO-16). It currently allows any base address to be configured but the hardware only supports base addresses (set by on-board jumpers) in the range 0x100 to 0x3F8 on 8-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/aio_iiro_16.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/aio_iiro_16.c b/drivers/comedi/drivers/= aio_iiro_16.c index 739cc4db52ac..00d0bb0f6256 100644 --- a/drivers/comedi/drivers/aio_iiro_16.c +++ b/drivers/comedi/drivers/aio_iiro_16.c @@ -167,7 +167,8 @@ static int aio_iiro_16_attach(struct comedi_device *dev, struct comedi_subdevice *s; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x8); + ret =3D comedi_check_request_region(dev, it->options[0], 0x8, + 0x100, 0x3ff, 0x8); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp82.ord1d.emailsrvr.com (smtp82.ord1d.emailsrvr.com [184.106.54.82]) (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 AE2E7347FC4 for ; Fri, 30 Jan 2026 17:11:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.82 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793109; cv=none; b=Ux3+w/qILFC4Qk4QZDER7PcZuvVnNrVZvfwcYiO2IG59Htujouh/RSPhMHVlqaQHVUjT+2W1mwOqR91c4Zqm6MWdixf6Vjtwe62BvkfUXB00zQhW/qArrtp6+yZGpyfupGkYvO60R1/7FIj/PgKiBrGWqh3qk1z1SAypD9c4gXU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793109; c=relaxed/simple; bh=JLBg96HHc/Pl1yZ6W1y8i3QL5bXjiybg7vwXzmHgPE8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NoDhBAhW2TeU60uhAyGfiwbrrECSNeqNQYA4VEzXu5VEjgwPQG4JC4b4vyTBTWzuCUxSX7QFo/i1HGNi3LWXk35qMG70eTAw3LNwd+qx/XuULrHEWZpnwq4Z/4zywEGuu8Uq+A1f+iD1IxnZDtChxSb1QFFifCAa7TVvH9rRXTE= 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=hZKnl8SH; arc=none smtp.client-ip=184.106.54.82 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="hZKnl8SH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792677; bh=JLBg96HHc/Pl1yZ6W1y8i3QL5bXjiybg7vwXzmHgPE8=; h=From:To:Subject:Date:From; b=hZKnl8SHjRICOry4dAPhGek3bTIOj0D0nb7/sy0yzRfniwXRyI6/GiukEH/cwriEF OM/oEaJrkOTkyzpCGigDScLGAyrSCSetQilB2o6PB3nZVBusya99lI8fRnlM/yR1fA TpmGrr/77kcDlxRdzpsY5SZpVleFqyOAPAMjbE7E= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 6ABE3602E5; Fri, 30 Jan 2026 12:04:36 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 06/46] comedi: amplc_dio200: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:31 +0000 Message-ID: <20260130170416.49994-7-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-7-1 Content-Type: text/plain; charset="utf-8" The "amplc_dio200" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a supported board (PC212E, PC214E, PC215E, PC218E, or PC272E). It currently allows any base address to be configured but the hardware only supports base addresses (set by on-board DIP switches) in the range 0 to 0xFE0 on 32-byte boundaries. (Technically, the DIP switches allow 16-byte boundaries, but I do not think that is advisable given that the boards decode a 32-byte address range.) Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/amplc_dio200.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/amplc_dio200.c b/drivers/comedi/drivers= /amplc_dio200.c index 4544bcdd8a70..8b1cbc3d24e5 100644 --- a/drivers/comedi/drivers/amplc_dio200.c +++ b/drivers/comedi/drivers/amplc_dio200.c @@ -242,7 +242,8 @@ static int dio200_attach(struct comedi_device *dev, str= uct comedi_devconfig *it) { int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x20); + ret =3D comedi_check_request_region(dev, it->options[0], 0x20, + 0, 0xfff, 0x20); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp82.ord1d.emailsrvr.com (smtp82.ord1d.emailsrvr.com [184.106.54.82]) (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 BABA53590A4 for ; Fri, 30 Jan 2026 17:11:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.82 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793111; cv=none; b=EgL1Uds5w4RlCE7mHq+FODJfgPfwI4ttTgFLtDvgJWOAcm0P4vSlcz/Q8kAtIRHXsqOv2OLqNWmNXZlTdQvGHzmHDE4pCDlgig+cFUsVDwEZEWXvE+7Uojpl5mjWEdtPyYQWK5tRoxsYEXN19FNDIsTbzrUyDdC+t/z/VgJJcV0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793111; c=relaxed/simple; bh=yQZVnBTx0nGZHwR2d2ypziqfr/nt7ZXizswIE0zJ5Ks=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PGKgwY8947plV1UWv4/HY0HBxAFWq7rqHOnM7aDSlK0TrjKOjZ7R9GnuqykYUDChUdJQUlnz6QcFP/Arx/ZpN3Rk+tzWhHjBxngV3p9MJPGUlp+nLCSkPXQxZnPfBFkNtUUsDjCvvEW6WWpTjcfHSnG+Nc6efEZ+9vMbrHNyfO0= 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=XzsXWYWN; arc=none smtp.client-ip=184.106.54.82 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="XzsXWYWN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792678; bh=yQZVnBTx0nGZHwR2d2ypziqfr/nt7ZXizswIE0zJ5Ks=; h=From:To:Subject:Date:From; b=XzsXWYWNlQyhprV7KFF/Sw4yMnCF0iUMdgIpCsUC7ZTlFh5VxcPGpbLUOd5YWR7yt mJ9O5hdqnxR1RQXD966eonEeuN3qKI7DGz80KPI2vsCTJryPHezoW9/Phgor49J9C6 pErISHXZv6KpS+C+5tHjTGaBvGSmC7MN9IjeJ1x8= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 6CE38602EC; Fri, 30 Jan 2026 12:04:37 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 07/46] comedi: amplc_pc236: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:32 +0000 Message-ID: <20260130170416.49994-8-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-8-1 Content-Type: text/plain; charset="utf-8" The "amplc_pc236" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a supported PC36AT board. It currently allows any base address to be configured but the hardware only supports base addresses (set by on-board DIP switches) in the range 0 to 0xFFC on 4-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/amplc_pc236.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/amplc_pc236.c b/drivers/comedi/drivers/= amplc_pc236.c index b21e0c906aab..eadee10983bf 100644 --- a/drivers/comedi/drivers/amplc_pc236.c +++ b/drivers/comedi/drivers/amplc_pc236.c @@ -45,7 +45,8 @@ static int pc236_attach(struct comedi_device *dev, struct= comedi_devconfig *it) if (!devpriv) return -ENOMEM; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x4); + ret =3D comedi_check_request_region(dev, it->options[0], 0x4, + 0, 0xfff, 4); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp86.ord1d.emailsrvr.com (smtp86.ord1d.emailsrvr.com [184.106.54.86]) (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 53C43356A07 for ; Fri, 30 Jan 2026 17:04:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.86 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792683; cv=none; b=cdNAfQHhbmL1siNieVyd9odXVPsRVRlVJISijPUjZqfYNT+clbMutzbsi93YlO9kXz6IKkETxIm5kh2jWE2xDSOHFoNG0FEEWaWdZ43XFQyNkU4Q1Vr+rt6Gt2EZCYZQW0LMbP+6R54J1mRlQaEkMwhhjd3toV0Pz95A6dg46vI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792683; c=relaxed/simple; bh=1Y0SZ//9gz477lVmgAauRZwxck0cq0LKjL2wAPKFwGc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Jh1fAt03iLNAMKq3ZXmQIlc2Goq7lbZp8+sq35VkOdkC/TU4qA5Uar8sj4d0XrYxPCTIcfPnWgUEuHHlIlGGAtZw7EAtcSylF69xIhxvLfzpU6eSCGhtS0ka50IYhjmv7ONMpe8Ks4ZGaA4Od3xUhPvf9v6OS/m0R7d7v+steDk= 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=C6oLDPRE; arc=none smtp.client-ip=184.106.54.86 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="C6oLDPRE" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792679; bh=1Y0SZ//9gz477lVmgAauRZwxck0cq0LKjL2wAPKFwGc=; h=From:To:Subject:Date:From; b=C6oLDPREEPGypXRFCvmcllXBUUkXkX26hRZPH5jiHuF50Q7k10gmhyysFqqEJlJCs TJCWqkOyx20cJ4EuRcHfg8j0pwnZoqUsGSag0FwNjy3sI4MrNK67Ty0v1TzManKdyN Ybu78PIT1kiMpeRbxNgH45HIbqODyzS9DRdVmJqY= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 73246602EF; Fri, 30 Jan 2026 12:04:38 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 08/46] comedi: amplc_pc263: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:33 +0000 Message-ID: <20260130170416.49994-9-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-9-1 Content-Type: text/plain; charset="utf-8" The "amplc_pc263" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a supported PC263 board. It currently allows any base address to be configured but the hardware only supports base addresses (set by on-board DIP switches) in the range 0 to 0x7FE on 2-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/amplc_pc263.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/amplc_pc263.c b/drivers/comedi/drivers/= amplc_pc263.c index d7f088a8a5e3..e2196dc9d426 100644 --- a/drivers/comedi/drivers/amplc_pc263.c +++ b/drivers/comedi/drivers/amplc_pc263.c @@ -61,7 +61,8 @@ static int pc263_attach(struct comedi_device *dev, struct= comedi_devconfig *it) struct comedi_subdevice *s; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x2); + ret =3D comedi_check_request_region(dev, it->options[0], 0x2, + 0, 0x7ff, 2); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp86.ord1d.emailsrvr.com (smtp86.ord1d.emailsrvr.com [184.106.54.86]) (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 828553587C3 for ; Fri, 30 Jan 2026 17:04:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.86 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792687; cv=none; b=GTB7igt3lnuaxeKrcgXyVY2vFFtsLKn5SWJTqBsVZRlRDN4UVcCBk4XKlMvh39sm/XbuJInGKT7Al6eOjTuzxnqa9XZcg3ZwaCnYI09qFSvnCMr6ebUgUyxc5+rlYwksYqBLuEAsRBF5faM9H+n6yM8SkyLSxk5hRVxITPn2CxY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792687; c=relaxed/simple; bh=1+BdDelj2jJtq3dXj2q+MCmgrtzL2WGyRNfXNkrl5qk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ivmycZFxWHuAYqz0Y8aKaCNKVTdQicTTDDeTQOJJdgfndRlA2DQF8HPRMPUj1Rc0Mpk9pAMmldwQkebhICgY4/fB+Mjl3S44MrRPGX+r8hAJmQy+neJRjUJm1QQExoUXonNqeWHNqX5ehvc3kp1+LvIkKeHSLxWxcEyaXWQYJtw= 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=RCFkwbQD; arc=none smtp.client-ip=184.106.54.86 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="RCFkwbQD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792680; bh=1+BdDelj2jJtq3dXj2q+MCmgrtzL2WGyRNfXNkrl5qk=; h=From:To:Subject:Date:From; b=RCFkwbQDEYAGklw+DbXKQp9VlmrL2zaKCM6kby3LOvuEtch2PYHkdQIAXJkaapvxv n8QwdU99ycGgESvaXCoco3WM9OU1YbweVJGvqJ0ceK4+nhIbpMPfSTAvF15YoKZ13X S35+tyL9gtNhq0sGzRx3cOI1/sYePpHymewiDDLU= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 77379602F1; Fri, 30 Jan 2026 12:04:39 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 09/46] comedi: c6xdigio: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:34 +0000 Message-ID: <20260130170416.49994-10-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-10-1 Content-Type: text/plain; charset="utf-8" The "c6xdigio" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a supported C6x_DIGIO DSP device connected to a PC printer parallel port (driving the port's I/O registers directly). Currently, the driver allows any I/O base address to be specified as long as the I/O region can be reserved, and it converts the specified `int` option value holding the base address to `unsigned long`. It doesn't make sense to allow base addresses that are not aligned to 4-byte boundaries (for SPP printer ports, although printer ports with EPP/ECP support actually need to be aligned on 8-byte boundaries), so add a check for 4-byte alignment. Convert the option value that specifies the base address from `int` to `unsigned int` instead of `unsigned long` so it ends up the same on 32-bit and 64-bit systems. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/c6xdigio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/c6xdigio.c b/drivers/comedi/drivers/c6x= digio.c index 8a38d97d463b..b6563a48ada6 100644 --- a/drivers/comedi/drivers/c6xdigio.c +++ b/drivers/comedi/drivers/c6xdigio.c @@ -239,9 +239,11 @@ static int c6xdigio_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; + unsigned int iobase =3D it->options[0]; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x03); + ret =3D comedi_check_request_region(dev, iobase, 0x03, + 0, UINT_MAX, 4); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp86.ord1d.emailsrvr.com (smtp86.ord1d.emailsrvr.com [184.106.54.86]) (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 CEAAA3451D5 for ; Fri, 30 Jan 2026 17:04:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.86 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792688; cv=none; b=tKB0/3TSMOcfz9dqCR9atFJiuNRt4qSsMO4lnY+xp5VtBAPlqgQ0hD+79rRIq24EwLVJARGsBiMH5CDGJvzMjL86L5dbfV1hKS2jBtQLSeZTCmsupXTL0S8ofszqXO9e9MMXxOibaqFfE5axxBB6t54msppPuppa8eGmdaFf7ow= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792688; c=relaxed/simple; bh=ui9ZgPEYHtHAHYqW2T/xend/CaIhxuFKbKEvQJ7K3Qc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cwoZgjzgHLER6okKYZL8xiTff6EZYCyJjuFmAzCTwJ1wIxXBTujjPEYIi7p3qx156An0bVyZmehXEPmNrLpmqFdbErdMvpnLgSm5L89i6amlUEe2Ogv2iyzazrhgTmvNs/MVAbDpzik3ZOJ94fj9uXFBMgYkRcJQwsV4xq2VYD4= 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=AoGTzo7q; arc=none smtp.client-ip=184.106.54.86 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="AoGTzo7q" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792681; bh=ui9ZgPEYHtHAHYqW2T/xend/CaIhxuFKbKEvQJ7K3Qc=; h=From:To:Subject:Date:From; b=AoGTzo7qrF2eavx/oQ2/SXC1LgWfR6a+YcJA/ePDMVXVNOcx3yMEBX08K/gix4mGu 4CXPhfVdirN6aiApx+U8sd8tdg9jsxiAdt08I3CwP+ZdAkKIj5dvbHQUNN4ZWyBW0p nTFsxH+TboAklBP2+6Z8LgXUrqSCbnb/G6raMPec= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 895E4602F6; Fri, 30 Jan 2026 12:04:40 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 10/46] comedi: comedi_parport: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:35 +0000 Message-ID: <20260130170416.49994-11-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-11-1 Content-Type: text/plain; charset="utf-8" The "comedi_parport" driver treats a standard printer parallel port as a COMEDI digital I/O device, driving the port's I/O registers directly. It uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of the device. Currently, the driver allows any I/O base address to be specified as long as the I/O region can be reserved, and it converts the specified `int` option value holding the base address to `unsigned long`. It doesn't make sense to allow base addresses that are not aligned to 4-byte boundaries (for SPP printer ports, although printer ports with EPP/ECP support actually need to be aligned on 8-byte boundaries), so add a check for 4-byte alignment. Convert the option value that specifies the base address from `int` to `unsigned int` instead of `unsigned long` so it ends up the same on 32-bit and 64-bit systems. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/comedi_parport.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/comedi_parport.c b/drivers/comedi/drive= rs/comedi_parport.c index 098738a688fe..2604680d86c4 100644 --- a/drivers/comedi/drivers/comedi_parport.c +++ b/drivers/comedi/drivers/comedi_parport.c @@ -225,9 +225,11 @@ static int parport_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; + unsigned int iobase =3D it->options[0]; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x03); + ret =3D comedi_check_request_region(dev, iobase, 0x03, + 0, UINT_MAX, 4); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp82.ord1d.emailsrvr.com (smtp82.ord1d.emailsrvr.com [184.106.54.82]) (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 74163357714 for ; Fri, 30 Jan 2026 17:04:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.82 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792685; cv=none; b=t8mvnFCP7IcjNx9Ezx1YJscvd755QM9DzhBnGbpyDJMaGFxgOqUVO5D/zao0iAUmd0Md0j59hGhkqvneJHR4yI7ylu4kPTZhQ0gwhg4iSdICz8sLIKwo8G86O9kzdKlh4PurEwGoY07ZQyxUPpFELL/DV694o0hv6/MUpgflXo0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792685; c=relaxed/simple; bh=d9B+RL2+UH5QxZ5qABG0TuhtSZiM+KTMtpJ+NHNoRXI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hPjZE8Xl0Oo867zsGZx8CUYTYL1TVrxgAP2rFvs3nu19UcVLHjP1P3vYJUVmIlC7q+GeCvyqQ6X9D+aTy0gASxYhTn2FzaY+UBoOsfgZoz8+CtUn1DzSey3UoVI1a3srG4NpCzJGZP+0Ptggrh4PE0BoCermmDlEhBSE8WyCPoM= 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=yHiLmTQ8; arc=none smtp.client-ip=184.106.54.82 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="yHiLmTQ8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792682; bh=d9B+RL2+UH5QxZ5qABG0TuhtSZiM+KTMtpJ+NHNoRXI=; h=From:To:Subject:Date:From; b=yHiLmTQ8oJnZ1FUzGhzEx1EMZREViTLaQzbdJ68bQIR2RcslqxfL6SVFgQ4q/Xg4Y jtG6oKAMHNiCtg04VspuhN7PfFPRu0SIl+P9/BBouRzC9Zxhw6mqgRAQuReSd5tqyZ 3gT/hxzxoRlAimbu+RuORj78DH+dWubglJLAmjLc= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 911C8602F9; Fri, 30 Jan 2026 12:04:41 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 11/46] comedi: dac02: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:36 +0000 Message-ID: <20260130170416.49994-12-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-12-1 Content-Type: text/plain; charset="utf-8" The "dac02" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a supported DAC-02 board. It currently allows any base address to be configured but the hardware only supports base addresses (configured by an on-board DIP switch) in the range 0x200 to 0x3f8 on 8-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/dac02.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/dac02.c b/drivers/comedi/drivers/dac02.c index 4b011d66d7b0..2c04472c5078 100644 --- a/drivers/comedi/drivers/dac02.c +++ b/drivers/comedi/drivers/dac02.c @@ -103,7 +103,8 @@ static int dac02_attach(struct comedi_device *dev, stru= ct comedi_devconfig *it) struct comedi_subdevice *s; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x08); + ret =3D comedi_check_request_region(dev, it->options[0], 0x08, + 0x200, 0x3ff, 8); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp85.ord1d.emailsrvr.com (smtp85.ord1d.emailsrvr.com [184.106.54.85]) (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 333CA34B19A for ; Fri, 30 Jan 2026 17:11:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.85 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793111; cv=none; b=ofcGCyz0X7URytwlcHE0/qM164x1sNcpPBjZV65gLvZUeCGETMIuumkk84i/783drMtkRP1kH0QUg2bO3WpNrVtLhqfIFhptUxjqlQAETTP2JnbKmDVu+YGn8MPTfINisftwAG/+JwtUJzRNevGqz5SBJPvKNs5X/hOKUSHMeGg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793111; c=relaxed/simple; bh=Xy1g3sCF37/uNg+TTdbBO4S6LEPcQJQ9G06ORx0YQsA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AqNteBVsXBMOfbBD6IhiI1AT79W4mz/0JqgVKmYXMyCdj7xpVxXutfV0gq61bwTIleNXvTm+aGDxDfkPtY7KLqvQFbFpGYMtcH76D8HFQWw5XdNm5q8FWwse6gKW4VIEQjHUprIAQDwMXc9nBIhnUmv7GkImDkkf9z39+FV/wuk= 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=cYEK4+uR; arc=none smtp.client-ip=184.106.54.85 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="cYEK4+uR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792683; bh=Xy1g3sCF37/uNg+TTdbBO4S6LEPcQJQ9G06ORx0YQsA=; h=From:To:Subject:Date:From; b=cYEK4+uRe44amaCbFV/EdG9/FP75281qIUL7ig0AligkRa9eHz88NF2qFZwmh1Fa/ U2YURfwnbM969ecV2b7Itf1tnfzrk4RqBOegOjLT5IRoY7bGk2fUqOClu9MESg9LEG xIg+1dOcjntNcjjmnfex32tpy7KjDrm9QlfRnekY= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 96BD2602FD; Fri, 30 Jan 2026 12:04:42 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 12/46] comedi: das08_isa: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:37 +0000 Message-ID: <20260130170416.49994-13-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-13-1 Content-Type: text/plain; charset="utf-8" The "das08_isa" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a supported board in the DAS08 family. It currently allows any base address to be configured but the hardware only supports base addresses (configured by an on-board DIP switch) in the range 0 to 0x3f0 on 16-byte boundaries. (Technically, the DIP switches allow 8-byte boundaries, but I do not think that is advisable given that the boards decode an 16-byte address range.) Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/das08_isa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/das08_isa.c b/drivers/comedi/drivers/da= s08_isa.c index 3d43b77cc9f4..1b022dc10b78 100644 --- a/drivers/comedi/drivers/das08_isa.c +++ b/drivers/comedi/drivers/das08_isa.c @@ -167,7 +167,8 @@ static int das08_isa_attach(struct comedi_device *dev, if (!devpriv) return -ENOMEM; =20 - ret =3D comedi_request_region(dev, it->options[0], board->iosize); + ret =3D comedi_check_request_region(dev, it->options[0], board->iosize, + 0, 0x3ff, board->iosize); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp82.ord1d.emailsrvr.com (smtp82.ord1d.emailsrvr.com [184.106.54.82]) (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 4CE0E357715 for ; Fri, 30 Jan 2026 17:04:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.82 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792689; cv=none; b=X3b4pufQwW7MJ4f898IH56aiSf/sxz+Ev3cCoM8jOIE46oajvsJiAUsQOXF9LDXe/fybuwiZ2E3nfnMmP8F2ISZGDGFI1HyYuG42w/nQ1mzxcDaQqH1QKk8ZASuqkzP2Zku3cBpI+5oqrM7XyJI1I0Wug/qyZI57I0fsYHFKdXQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792689; c=relaxed/simple; bh=K0k6H4oFK+wtakFAw6qBGCSbxhvsHg4MJSUk7IwqkKg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kkAs1DXDhziCIgAbT3HVFyf1nxcpR4hE8JRHvrWHEo3USnn+7HqII+QFs0r29FsFB6CN34vHZ5iWqORU1+JD9xi7YcWsEAib7rNDp5idke2P5gjWMAjom3AHKJmyUSSXaD2DFmeOxQwG19Xz2CM12tYt785qPYZq4z3zDQ5FMzY= 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=FWHzjNo3; arc=none smtp.client-ip=184.106.54.82 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="FWHzjNo3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792684; bh=K0k6H4oFK+wtakFAw6qBGCSbxhvsHg4MJSUk7IwqkKg=; h=From:To:Subject:Date:From; b=FWHzjNo3BWUAN/ZIJ2lD60KGfFN5WOVcO5Pa/aQkQr+w1gz2HlxqpiRAWf//WSUp9 YVVn3dYqQo0qUT0ZRPBMq2/s5VCK5d6GbREIsR/Qi4bCL+7M3k71TQW+gM5/1TylEg JBDqk4p/q5lZwsm++gJt4HjlbYZrSAAX8MIft3Cs= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 99EEB602FA; Fri, 30 Jan 2026 12:04:43 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 13/46] comedi: das16: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:38 +0000 Message-ID: <20260130170416.49994-14-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-14-1 Content-Type: text/plain; charset="utf-8" The "das16" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a various DAS16 compatible boards. It currently allows any base address to be configured but the hardware only supports base addresses (configured by an on-board DIP switch) in the range 0 to 0x3f0 on 16- or 32-byte boundaries. Some of the boards have an 8255 chip at offset 0x10 and require the board to be configured on a 32-byte boundary unless some on-board jumpers are set to limit the board to decoding only the first 0x10 registers, disabling access to the 8255. Some other boards place the 8255 chip (and some other registers) at offset 0x400 from the base address, decoding 0x10 registers at the base address and 0x8 registers at the base address plus 0x400. Add a sanity check to ensure the device is not configured at an unsupported base address. If the device has the 8255 chip at offset 0x10, and is being configured with the base address at an odd 16-byte boundary, limit the size of the region to 0x10 and disable the 8255 subdevice. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/das16.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/drivers/comedi/drivers/das16.c b/drivers/comedi/drivers/das16.c index 1f85572c21b4..6eebfda2cb53 100644 --- a/drivers/comedi/drivers/das16.c +++ b/drivers/comedi/drivers/das16.c @@ -1018,6 +1018,7 @@ static int das16_attach(struct comedi_device *dev, st= ruct comedi_devconfig *it) const struct das16_board *board =3D dev->board_ptr; struct das16_private_struct *devpriv; struct comedi_subdevice *s; + unsigned int iobase =3D it->options[0]; unsigned int osc_base; unsigned int status; int ret; @@ -1037,11 +1038,25 @@ static int das16_attach(struct comedi_device *dev, = struct comedi_devconfig *it) devpriv->dev =3D dev; =20 if (board->size < 0x400) { - ret =3D comedi_request_region(dev, it->options[0], board->size); + unsigned int size =3D board->size; + + if (size > 0x10 && (iobase & 0x10) !=3D 0) { + /* + * The board has more than 0x10 registers and is + * being placed on an odd 16-byte boundary. The + * board has some jumpers to configure this mode, + * disabling the 8255 at offset 0x10, so only 0x10 + * registers will need to be mapped in this mode. + */ + size =3D 0x10; + } + ret =3D comedi_check_request_region(dev, iobase, size, + 0, 0x3ff, 16); if (ret) return ret; } else { - ret =3D comedi_request_region(dev, it->options[0], 0x10); + ret =3D comedi_check_request_region(dev, iobase, 0x10, + 0, 0x3ff, 16); if (ret) return ret; /* Request an additional region for the 8255 */ @@ -1146,9 +1161,15 @@ static int das16_attach(struct comedi_device *dev, s= truct comedi_devconfig *it) /* 8255 Digital I/O subdevice */ if (board->has_8255) { s =3D &dev->subdevices[4]; - ret =3D subdev_8255_io_init(dev, s, board->i8255_offset); - if (ret) - return ret; + if (board->i8255_offset =3D=3D 0x10 && (dev->iobase & 0x10) !=3D 0) { + dev_info(dev->class_dev, + "Disabling 8255 subdevice on unsupported base address\n"); + s->type =3D COMEDI_SUBD_UNUSED; + } else { + ret =3D subdev_8255_io_init(dev, s, board->i8255_offset); + if (ret) + return ret; + } } =20 das16_reset(dev); --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp87.ord1d.emailsrvr.com (smtp87.ord1d.emailsrvr.com [184.106.54.87]) (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 985973502B3 for ; Fri, 30 Jan 2026 17:04:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.87 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792690; cv=none; b=taI9ezLvR83BD38YCWNa7tSaQu6ktujHdxiPaQJWvipCZF5x0SjabNwI3lI6QiONeGAccvPjC1dyoCzJdcz5ZgnpNVnilKOhYuHMpB+SDaPULRGcdZXo1kke+MPN+ffbbqI3R5vUcOFYQqhnAY7ru0yhtyrSn+i3ntCPdaMB30o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792690; c=relaxed/simple; bh=T+VEziWL4pC/DdTQ+CsMIfbW1uMy6EZlGyGaXgcaUGE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WeSlUIziVf5gpX4EdyYqdzni28WBbYEA34btz6ShOd/s2mY5UAQpm5DSPJXF9I7CCoHSEnGf+x1TmpzjlHvRe5VH4Vy2DuWBxthpNUbcl26VPv+hBAS72HcxWHuaN/jObkaDMaTT5ITfLttKd4TH9TRAoMLhZriaDbogOI1mSVA= 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=A5viHTCT; arc=none smtp.client-ip=184.106.54.87 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="A5viHTCT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792685; bh=T+VEziWL4pC/DdTQ+CsMIfbW1uMy6EZlGyGaXgcaUGE=; h=From:To:Subject:Date:From; b=A5viHTCTZ3fyF38U22Qxsaz0GQzkn7ng5InGubJWAV3lhDUKrVtagD/JuCJUAUMx/ whnbgQeEPht5NrqIvPF7cGyoLge7ML9d+6MqyjUBeXS4dlL7aiuuufLV1vxxYnw+Z3 ZEIZdDkk1etq10FIiCmjzXCi5DEjtzWh0BuHVkjE= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id A0FC660301; Fri, 30 Jan 2026 12:04:44 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 14/46] comedi: das16m1: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:39 +0000 Message-ID: <20260130170416.49994-15-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-15-1 Content-Type: text/plain; charset="utf-8" The "das16m1" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a DAS16/M1 board. It currently allows any base address to be configured but the hardware only supports base addresses (configured by an on-board DIP switch) in the range 0 to 0x3f0 on 16-byte boundaries. It has an additional span of 0x8 registers at offset 0x400 from the main 0x10 byte region. Add a sanity check to ensure the device is not configured at an unsupported base address. If the main base address is correctly aligned and within range, then the additional region at offset 0x400 from the configured base address will naturally be within range and correctly aligned. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/das16m1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/das16m1.c b/drivers/comedi/drivers/das1= 6m1.c index 1b638f5b5a4f..9f531ba593b4 100644 --- a/drivers/comedi/drivers/das16m1.c +++ b/drivers/comedi/drivers/das16m1.c @@ -511,7 +511,8 @@ static int das16m1_attach(struct comedi_device *dev, if (!devpriv) return -ENOMEM; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x10); + ret =3D comedi_check_request_region(dev, it->options[0], 0x10, + 0, 0x3ff, 16); if (ret) return ret; /* Request an additional region for the 8255 and 3rd 8254 */ --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp82.ord1d.emailsrvr.com (smtp82.ord1d.emailsrvr.com [184.106.54.82]) (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 99755357716 for ; Fri, 30 Jan 2026 17:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.82 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792689; cv=none; b=reRa2lTGLKy78htsH1ErgLUfhWtg9d7t7IX/gfQSvXelM/Z5jkD6fotssXrcCD4QF+APlPgU79A+RHnT5xbwtVWt3Ed+A7CsBxZD0WrrBsavf0ixdBeDUH/f+AsTDb2NJbxqQppmP2w4w6YtM6fOSPJVwg8RYiLYpT5+c9upzRw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792689; c=relaxed/simple; bh=56R6TJ37IxH77Nh4vrOS6uvnAjRcma3p97Or+x9ibj0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X2VCLnlOJkUrZbZH1EzPoxv0QW87FOMoWbkt3gVQQHvBdMJqeF8qg0AKcdDO5PlseYQBfQYqqVtFPQ8c3/tJv4oUkAHddT7icoMf9QS5yH0oFCt8pCc/2YOoZJKzUKqZ+SiJH2Z8rXmB5KkhzmD2+VyNh+9zIUrVz5aiisLlGZ0= 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=y0RzNd1O; arc=none smtp.client-ip=184.106.54.82 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="y0RzNd1O" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792686; bh=56R6TJ37IxH77Nh4vrOS6uvnAjRcma3p97Or+x9ibj0=; h=From:To:Subject:Date:From; b=y0RzNd1O6qe6+kgnqQY2YJM0jYijRma04OI/7itiF+JN5Uklwwo00rjG5pvd+t6SZ pOEq7815e3lCQ7H2W4YpRtLl5DJY2Ci/Xee8rzeDxTJ9gKFbC+ORMsLy8WOXohQJXj WQmF+QAYViuGOXWbQFvXJdCuJox/iNYE3wgTsOdA= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id AB47160306; Fri, 30 Jan 2026 12:04:45 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 15/46] comedi: das1800: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:40 +0000 Message-ID: <20260130170416.49994-16-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-16-1 Content-Type: text/plain; charset="utf-8" The "das1800" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a board compatible with the DAS1800 series. It currently allows any base address to be configured but the hardware only supports base addresses (configured by an on-board DIP switch) in the range 0 to 0x3f0 on 16-byte boundaries. Some boards have an additional span of up to 0x10 registers at offset 0x400 from the main 0x10 byte region. Add a sanity check to ensure the device is not configured at an unsupported base address. If the main base address is correctly aligned and within range, then the additional region at offset 0x400 from the configured base address will naturally be within range and correctly aligned. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/das1800.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/das1800.c b/drivers/comedi/drivers/das1= 800.c index 7117c67aee7e..7d7ea99a81aa 100644 --- a/drivers/comedi/drivers/das1800.c +++ b/drivers/comedi/drivers/das1800.c @@ -1172,7 +1172,8 @@ static int das1800_attach(struct comedi_device *dev, if (!devpriv) return -ENOMEM; =20 - ret =3D comedi_request_region(dev, it->options[0], DAS1800_SIZE); + ret =3D comedi_check_request_region(dev, it->options[0], DAS1800_SIZE, + 0, 0x3ff, 16); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp82.ord1d.emailsrvr.com (smtp82.ord1d.emailsrvr.com [184.106.54.82]) (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 DB5D6359710 for ; Fri, 30 Jan 2026 17:11:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.82 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793111; cv=none; b=BOTatYA67AkrOP3LaZuPLp+2tqjtKt9byiy+fj5sxOuymnx0T44CDhE0PiWcDbSZMSmv1mqY2Gks7Ty8QUo3hJs8mpvRs2BtjAIM/mJwqQaF9QLk0in3w2+PQ/OIR37L6SbGJfgTOz0WKWqKBnGeLi4rO+amkDwCucKh8hGItjo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793111; c=relaxed/simple; bh=wAFCKiX9JskeBja6KTyYY4qbje1cA7mIu3VYi1891V4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=amy2/H6EwXdVmFRmuqZDUXD9i7GwkmvT4KiLJN405n0NJvey9K+0NXwrGo5/cd29gvFHYPrDilqPFVYHhGw70BZIFdmrx2do3Ct6b4ulszAn36Yutwgpl0OvnX+NC+diF1Msf2JEkSQp1mPmvO64gKA+ZR9WCYXFSLmPSzZ/FYY= 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=KVk2z4ow; arc=none smtp.client-ip=184.106.54.82 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="KVk2z4ow" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792687; bh=wAFCKiX9JskeBja6KTyYY4qbje1cA7mIu3VYi1891V4=; h=From:To:Subject:Date:From; b=KVk2z4owAPsl8sfeWLeICptOsApa/zmEiCtCvfBFL7fF/smhWiY11KZ6HZXagvDrK SCVWdai1xpjgfDgIsUEP0QIyj0qqWiLWdT1lKk5kcgsVFDdSxaLOo3vYyrNIkqiIbk Ab3bt7zwd4HPZ57O3qgzKq8JZZpcEB0IOkNZxkZA= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id B0906602F4; Fri, 30 Jan 2026 12:04:46 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 16/46] comedi: das6402: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:41 +0000 Message-ID: <20260130170416.49994-17-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-17-1 Content-Type: text/plain; charset="utf-8" The "das6402" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a supported board in the DAS6402 family. It currently allows any base address to be configured but the hardware only supports base addresses (configured by an on-board DIP switch) in the range 0 to 0x3f0 on 16-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/das6402.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/das6402.c b/drivers/comedi/drivers/das6= 402.c index 7660487e563c..516a5d5a2840 100644 --- a/drivers/comedi/drivers/das6402.c +++ b/drivers/comedi/drivers/das6402.c @@ -560,7 +560,8 @@ static int das6402_attach(struct comedi_device *dev, if (!devpriv) return -ENOMEM; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x10); + ret =3D comedi_check_request_region(dev, it->options[0], 0x10, + 0, 0x3ff, 16); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp82.ord1d.emailsrvr.com (smtp82.ord1d.emailsrvr.com [184.106.54.82]) (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 DF22135E54C for ; Fri, 30 Jan 2026 17:11:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.82 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793113; cv=none; b=UQlNZzGDdCOKz1hYj+afOWmOhNZWo3Um22RtUAhp5PDqlUfy6rTHlO1bB2pPxl6Eyri33WGEUflfKskvbt78P5V0sRTmM9d0Q8JDcvIVi0uGAtBUHtOOQLDSyfSjcpZ6qqblFtNw+4VNnvYqs6WZiHSmXqYhpp2ZAXC+PGOZ3fQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769793113; c=relaxed/simple; bh=0xEm8a+11lY/mX+NcqVJI4HuYL+R2PAUHG3/97SinGI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dNSfLZNP0firmodXBLyYApl2VqPN9dTUbgx7sDoRVn3FdcgrKxhucLFHSTH2NXkd565bPzUJOhklhA0Lk/S1NXk2zXcf9soMOEJp6PUqergKByJmOC1E1k1ZZZjGXtXGVrkHIjcZMox++UBBazub4XFw6dP0YTt18CYF8FJR0K8= 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=lCioFvO6; arc=none smtp.client-ip=184.106.54.82 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="lCioFvO6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792688; bh=0xEm8a+11lY/mX+NcqVJI4HuYL+R2PAUHG3/97SinGI=; h=From:To:Subject:Date:From; b=lCioFvO6wSZGLUsByD+hTw2Rg0jwHY63cCaY0FfbuFiv+pWtdUYxspjxziizhzrMz X0EGw8/1LyMUJMVGhLd+F1CwAEWJtMSTiP+FNFbI3bhaNsaSzcdnqJ2/325EUOKeDP wo8rnGVWamrap7VZRik31YiVkM/94VPQri4YoAm8= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id B7F06602F1; Fri, 30 Jan 2026 12:04:47 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 17/46] comedi: das800: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:42 +0000 Message-ID: <20260130170416.49994-18-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-18-1 Content-Type: text/plain; charset="utf-8" The "das800" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a supported board in the DAS800 family. It currently allows any base address to be configured but the hardware only supports base addresses (configured by an on-board DIP switch) in the range 0 to 0x3f8 on 8-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/das800.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/das800.c b/drivers/comedi/drivers/das80= 0.c index 300775523031..7563f40a4023 100644 --- a/drivers/comedi/drivers/das800.c +++ b/drivers/comedi/drivers/das800.c @@ -655,7 +655,8 @@ static int das800_attach(struct comedi_device *dev, str= uct comedi_devconfig *it) if (!devpriv) return -ENOMEM; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x8); + ret =3D comedi_check_request_region(dev, it->options[0], 0x8, + 0, 0x3ff, 8); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp84.ord1d.emailsrvr.com (smtp84.ord1d.emailsrvr.com [184.106.54.84]) (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 9C37C35A92A for ; Fri, 30 Jan 2026 17:04:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.84 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792693; cv=none; b=cp0s99Chtr7wfhjQxGinQfI99JOuwFO7MHmoYJBKDeAEbY0DfDhCc8Mf7I+JmrTi/xg5RlQ+I5UePE3tnSfoLvamGLsMlyGLFsu89s5xAH4HpKqMdGAIdp88uoRc7kvoE7789cT0djSnl8iS4R9T/zjb5uRrU0LKZlF2jwbmOcU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792693; c=relaxed/simple; bh=gS0bCEFKkxpiy9qE/LxjoabaeuYokeU/oXd9ZL1Rv+c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rnNJ9Nl/Kifj0wDwDg7fldEsHEI5K1uat/1pOl5Wbpprnsxo9LAm04+foFHjrBQeeePjv0j/pBhKs8hHPydwpph0XPHbn/4a9d0lZIFskovx/ZYhN5rTp1mHubFv9VYtfe3rkW9UHbLgLdfrzIDcJV/uOCShtPhBqxvtOlsxA9w= 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=BH1aqcht; arc=none smtp.client-ip=184.106.54.84 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="BH1aqcht" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792689; bh=gS0bCEFKkxpiy9qE/LxjoabaeuYokeU/oXd9ZL1Rv+c=; h=From:To:Subject:Date:From; b=BH1aqchtQcfO+JWxZQlDhd8gKFAfHiGmhiqlsFG0C4G3FFqWsW4Odh3we0F742BG6 LQuKWEMgzH8OR+E6+HvBNS4uUbOvFoW9+361B1t8rlcCovHaqwr5YxeFtj/G8ZYiM9 OP6Tg9Z0zNjQgmDc3esEiCzb1o3Q0bhwyTAe6W58= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id BEB7F602F0; Fri, 30 Jan 2026 12:04:48 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 18/46] comedi: dmm32at: Add sanity check for I/O base address Date: Fri, 30 Jan 2026 16:47:43 +0000 Message-ID: <20260130170416.49994-19-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-19-1 Content-Type: text/plain; charset="utf-8" The "dmm32at" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a Diamond-MM-32-AT board. It currently allows any base address to be configured but the hardware only supports 8 possible base addresses (selected by 3 on-board jumpers). These are 0x100, 0x140, 0x180, 0x200, 0x280, 0x300, 0x340, and 0x380. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/dmm32at.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/comedi/drivers/dmm32at.c b/drivers/comedi/drivers/dmm3= 2at.c index 910cd24b1bed..d1d9f75e168f 100644 --- a/drivers/comedi/drivers/dmm32at.c +++ b/drivers/comedi/drivers/dmm32at.c @@ -572,11 +572,27 @@ static int dmm32at_attach(struct comedi_device *dev, struct comedi_devconfig *it) { struct comedi_subdevice *s; + unsigned int iobase =3D it->options[0]; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x10); - if (ret) - return ret; + switch (iobase) { + case 0x100: + case 0x140: + case 0x180: + case 0x200: + case 0x280: + case 0x300: + case 0x340: + case 0x380: + ret =3D comedi_request_region(dev, iobase, 0x10); + if (ret) + return ret; + break; + default: + dev_err(dev->class_dev, "unsupported base address %#x\n", + iobase); + return -EINVAL; + } =20 ret =3D dmm32at_reset(dev); if (ret) { --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp87.ord1d.emailsrvr.com (smtp87.ord1d.emailsrvr.com [184.106.54.87]) (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 CE522357A4A for ; Fri, 30 Jan 2026 17:04:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.87 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792693; cv=none; b=IUTsVee1rXKq/Zeq4NjzIGTfHxj9kyzgDE9/r+/8aQh+4ddCdSq908jFVN5UDNJtSX9Y9BrFTTEAxEdWprKLXlsCytrzVd8HeCxepAmw2ebTu5BpKSuyAGjSCI8rMh7UbX4Qf1Un3IyarXh0wJqUHw25ipO51FEvXFiA93YIQiM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792693; c=relaxed/simple; bh=xH/qXmmDNLQWPdWvIdJXI7UKgvEybpD6VUNCS+BuyTQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aa5LAVT0JSzk0A6DDRU9T2b+orD3CIGMeLs/7uKHN5voLLtsWhlfETf49OkiTc1B8sAjtNGgWMtFqnyrJO2xj7YnHjYuQ3popi1my2PcwRiG2GOAHwuc752aEx63g58jg9ZjCNzKDMk3oK8fb4OF8gKvJP9iBeGFu8VlqThWOeM= 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=WKf3qYvK; arc=none smtp.client-ip=184.106.54.87 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="WKf3qYvK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792690; bh=xH/qXmmDNLQWPdWvIdJXI7UKgvEybpD6VUNCS+BuyTQ=; h=From:To:Subject:Date:From; b=WKf3qYvKvVSkRWXvljqi4U/z1R9cAJaIZBYwOz0qb27ziByjeAIDy8YMzqAeGYpXh 0DDtVnKYF/AusbIQyAESKwwLp0q2HRE5pP+CqP/CARWRrkNIIqcZOuGMEfKj3tbeV+ EnKQv9E1Jk1LyhTZBHE/xvHgvc/TWrwndJxiK35w= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id C1FC5602F9; Fri, 30 Jan 2026 12:04:49 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 19/46] comedi: dt2801: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:44 +0000 Message-ID: <20260130170416.49994-20-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-20-1 Content-Type: text/plain; charset="utf-8" The "dt2801" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a supported board in the DT2801 family. It currently allows any base address to be configured but the hardware only supports base addresses (configured by an on-board DIP switch) in the range 0x200 to 0x3fe on 2-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/dt2801.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/dt2801.c b/drivers/comedi/drivers/dt280= 1.c index 230d25010f58..d790e69f98a0 100644 --- a/drivers/comedi/drivers/dt2801.c +++ b/drivers/comedi/drivers/dt2801.c @@ -540,7 +540,8 @@ static int dt2801_attach(struct comedi_device *dev, str= uct comedi_devconfig *it) int ret =3D 0; int n_ai_chans; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x2); + ret =3D comedi_check_request_region(dev, it->options[0], 0x2, + 0x200, 0x3ff, 2); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp87.ord1d.emailsrvr.com (smtp87.ord1d.emailsrvr.com [184.106.54.87]) (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 9154635C1AB for ; Fri, 30 Jan 2026 17:04:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.87 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792694; cv=none; b=pAEx56HS35VsYK8pwGeV/lmz/JgJ+RrkegqANd91L+8XIcDxlJQ7RewO662AWhW1+/4D6SwGZSDoZiQ5yepm8EamL3r802kg5Zfh9imtTkSRlrGDcYuXklUHm8yp2BtX6skYIEfeVk2fj7zuAMfqtKrgohxpcHikP0gmOhT1Mwo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792694; c=relaxed/simple; bh=ehsO/fBZqwhcWv1pHjue2U0VAYvAea8gEGk0chey+BU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tAEvRjaH55THvfTEh3XA/x2iymFln2EemD6YGnxUaqpgxDuQ2194K7pL5eA0Q/XJipbSGV6xzff2wzDneymLhkkV33V0TL5r/4SllHeFzl1sVB2QOdLXj87AXhniXXDWNyVIUDY2myYh2iDeWzc1HOcntv+EGzME41MJRN3Av0k= 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=LIVgWqtc; arc=none smtp.client-ip=184.106.54.87 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="LIVgWqtc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792692; bh=ehsO/fBZqwhcWv1pHjue2U0VAYvAea8gEGk0chey+BU=; h=From:To:Subject:Date:From; b=LIVgWqtcjZewJ/Rh7LvkffZEeJdqakJp743CvUf+Ia18qb3efIWucFEMAyaMglk6d U5CxfThB4CnIqoPowJttOul/MV4JxNiOdVhr2jBw3A+5j5xNLwE6YwGS0lKVOLaGYQ ru+TcSAHoH7TVHWrSeOvtXgT+8pY+ZkOE+vHXlL8= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 492E8602FA; Fri, 30 Jan 2026 12:04:50 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 20/46] comedi: dt2811: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:45 +0000 Message-ID: <20260130170416.49994-21-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-21-1 Content-Type: text/plain; charset="utf-8" The "dt2811" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a supported board in the DT2811 family. It currently allows any base address to be configured but the hardware only supports base addresses (configured by on-board jumpers) in the range 0x200 to 0x3f8 on 8-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/dt2811.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/dt2811.c b/drivers/comedi/drivers/dt281= 1.c index dbb9f38da289..bcc4b5ef48e8 100644 --- a/drivers/comedi/drivers/dt2811.c +++ b/drivers/comedi/drivers/dt2811.c @@ -556,7 +556,8 @@ static int dt2811_attach(struct comedi_device *dev, str= uct comedi_devconfig *it) if (!devpriv) return -ENOMEM; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x8); + ret =3D comedi_check_request_region(dev, it->options[0], 0x8, + 0x200, 0x3ff, 8); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp86.ord1d.emailsrvr.com (smtp86.ord1d.emailsrvr.com [184.106.54.86]) (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 E2C3835FF78 for ; Fri, 30 Jan 2026 17:04:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.86 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792695; cv=none; b=r9iP1gMp3MR3iMFL1Kpez+15ClUtgIEMDApY5R9c6c9tZi7EKV1xZApOWgp4zHDBdG0Lacqc1c3chL55uuTd83ihJeF032ZRdLWYuTg6sDpYBt4aeG4hIF6X+C//XAqACwEXlW/7R8p3Vi+fDqAu4VyJFw8qckMh/Vk9rsRCNs0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792695; c=relaxed/simple; bh=iLoMF3hOLmC6Hhj13m6egLYOVU67/PY9Spjd1su+fOk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=NPS8FZWwtKJ/laKtmSoy4jUfnokVv5rSQoT2UNsTAEZDNdpX01ECTyK8mE9cUoAy4g3C8GPg1BZyvqfAyaBjMD0nPcuDwxHnmkPKXIfJt0wpvNxVr5GAQruFbWBXgBhqijaAtzLDotvKKxCMe+FNzhPXHTdII2F0iL8OpfMi0qY= 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=btS/8zJ8; arc=none smtp.client-ip=184.106.54.86 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="btS/8zJ8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792693; bh=iLoMF3hOLmC6Hhj13m6egLYOVU67/PY9Spjd1su+fOk=; h=From:To:Subject:Date:From; b=btS/8zJ8WxAx5FN0E/j0BAAqb9am8aH7LojIXc5HNfH1tiUcYAMWBIXONDNuBtRT/ kTDqr4YldMiVok7V9Z1uGp1jHYbOns2J8+LMCKAgOx9kQJkogyn4awmLf2QWt+2pDy nIbaqkYmlcEY9k8W5Um+jFhBMEtbUYZMv9LQQQD4= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 51F5B60300; Fri, 30 Jan 2026 12:04:52 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 21/46] comedi: dt2814: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:46 +0000 Message-ID: <20260130170416.49994-22-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-22-1 Content-Type: text/plain; charset="utf-8" The "dt2814" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a DT2814 board. It currently allows any base address to be configured but the hardware only supports base addresses (configured by an on-board DIP switch) in the range 0x200 to 0x3fe on 2-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/dt2814.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/dt2814.c b/drivers/comedi/drivers/dt281= 4.c index c98a5a4a7aec..caec16482afb 100644 --- a/drivers/comedi/drivers/dt2814.c +++ b/drivers/comedi/drivers/dt2814.c @@ -305,7 +305,8 @@ static int dt2814_attach(struct comedi_device *dev, str= uct comedi_devconfig *it) struct comedi_subdevice *s; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x2); + ret =3D comedi_check_request_region(dev, it->options[0], 0x2, + 0x200, 0x3ff, 2); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp85.ord1d.emailsrvr.com (smtp85.ord1d.emailsrvr.com [184.106.54.85]) (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 0323E364E9A for ; Fri, 30 Jan 2026 17:04:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.85 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792700; cv=none; b=Qw+gxOt/sW67g89Cna3wn1EjfaYXujVJWFlS4rR5e49Oao5uCTvKD/MSP2Mml/LN7tEvGgTrt057WiUEIJ69T23Vg7CZDAuPMKt3x671O4FR9aAL6EecpmB9Q1HOYoClUWO7R/UEWGM+zrc0Ol54vhWdjWjaXzdiJkdEOm2cnB4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792700; c=relaxed/simple; bh=hH+cmrwnlCK1REUtDUDW2TUtxxy3/LPP7hs7hRNUO5c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=psuys41dVzMp8MFrtEKS01QTQpfkKoLIcBLMbf7XYfnZF6Wmu4IFw3t8V/5X0BhRsSh2mpHipi20xOnnl72sepHHSC+mPy/eSxAvpoEGP4wptkNURu4tPIMV9bqTLB4FIqJmKl9zinbv4IpNO7ZnW+rjaixLpbembFXxBpRngr8= 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=aHwZzHZH; arc=none smtp.client-ip=184.106.54.85 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="aHwZzHZH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792696; bh=hH+cmrwnlCK1REUtDUDW2TUtxxy3/LPP7hs7hRNUO5c=; h=From:To:Subject:Date:From; b=aHwZzHZHs1bT9H0qxUCFIooh8FxtJDrK/7CXJHatw0yJmx4ClCZLKjXRCOQ1pcHNS 5FrY3vSjfslYVeefAzzSknlHjq7F3fyGHYVT+nDQ4hVnDjAj8Lrg+5z8bMhPq9+Y3Q uArOuiBkMfuhH+HqcDsO4RqLasvZqA+hkqMrPlkM= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 71361602FA; Fri, 30 Jan 2026 12:04:54 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 22/46] comedi: dt2815: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:47 +0000 Message-ID: <20260130170416.49994-23-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-23-1 Content-Type: text/plain; charset="utf-8" The "dt2815" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a DT2815 board. It currently allows any base address to be configured but the hardware only supports base addresses (configured by an on-board DIP switch) in the range 0x200 to 0x3fe on 2-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/dt2815.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/dt2815.c b/drivers/comedi/drivers/dt281= 5.c index 03ba2fd18a21..3fa184451523 100644 --- a/drivers/comedi/drivers/dt2815.c +++ b/drivers/comedi/drivers/dt2815.c @@ -144,7 +144,8 @@ static int dt2815_attach(struct comedi_device *dev, str= uct comedi_devconfig *it) const struct comedi_lrange *current_range_type, *voltage_range_type; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x2); + ret =3D comedi_check_request_region(dev, it->options[0], 0x2, + 0x200, 0x3ff, 2); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp87.ord1d.emailsrvr.com (smtp87.ord1d.emailsrvr.com [184.106.54.87]) (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 0DB5E35BDBF for ; Fri, 30 Jan 2026 17:04:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.87 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792699; cv=none; b=k8XRyYGuxAplEYyer1I0ZlHbkW6jBCLlqd4afcvetGcVvz8xwCncgFMRvyr6fV5X/31EIRiDGYuaZk0XPpyAZC6j2J09/QZtJtK1dT+XjfacwDI4sKo57H36afbL1KfE3GjFKXLTi7PXO2VohnMJmmDRT0MYBLqJcLn24rusa/w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792699; c=relaxed/simple; bh=49pyMBzeSZHCw6xBN0wnQawltZomg4O4ubc3Nki6NVs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=knxnTcVlaP98kM/KYN7g3pkOXMxICNgJZpgmORKQx/c91Uo1oNsqGwayffGPtWgySZUCvqsBt2iXB+mKwpwbKn3Ql8LLOxd8CGoFMPj25z8QHzwkYi5OzORk6sJgQ/4xmnv6TsOgv1L/KqcTjbmUXoUq2/UKGMnSEJ7rGd9oQEo= 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=OaBJzuwD; arc=none smtp.client-ip=184.106.54.87 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="OaBJzuwD" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792697; bh=49pyMBzeSZHCw6xBN0wnQawltZomg4O4ubc3Nki6NVs=; h=From:To:Subject:Date:From; b=OaBJzuwDNGj74k1jLDQgSz+2gqJvXWbduNdOqVS8d+qKCYrpUES3b7X9+h7JPCui4 cJPQL8ffoojhKYMfnd/0XWL9LBue44bvYSdBsvn4Zf6P5cq/CNySbJeMB436t4tvhs pT9NpyXrradoFCm/CLBj/EqXYwy1WUQAo3pRj/PQ= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 92BCB602FB; Fri, 30 Jan 2026 12:04:56 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 23/46] comedi: dt2817: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:48 +0000 Message-ID: <20260130170416.49994-24-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-24-1 Content-Type: text/plain; charset="utf-8" The "dt2817" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a DT2817 board. It currently allows any base address to be configured but the hardware only supports base addresses (configured by on-board jumpers) in the range 0x200 to 0x3f8 on 8-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/dt2817.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/dt2817.c b/drivers/comedi/drivers/dt281= 7.c index 6738045c7531..9fd5b47c7fa7 100644 --- a/drivers/comedi/drivers/dt2817.c +++ b/drivers/comedi/drivers/dt2817.c @@ -103,7 +103,8 @@ static int dt2817_attach(struct comedi_device *dev, str= uct comedi_devconfig *it) int ret; struct comedi_subdevice *s; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x5); + ret =3D comedi_check_request_region(dev, it->options[0], 0x5, + 0x200, 0x3ff, 8); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp85.ord1d.emailsrvr.com (smtp85.ord1d.emailsrvr.com [184.106.54.85]) (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 0568F35C180 for ; Fri, 30 Jan 2026 17:04:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.85 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792700; cv=none; b=avW6KtSo7S3GehOcUt67AOqt+0cDf/shuTUrRB+sCDAcfnAgwBpMOKY+E0aALj1ec57okYztExqUelXcRU9gWGfZIMb8zW37usc6N/2g61+ZbrOq4Jq6Lq8+RTnLEJ5pbKi9PFkSDP9TLkGHxlwlg+PNo8N2qzGBR1rO/0Oj7OM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792700; c=relaxed/simple; bh=ATr+7wcRjGrL5BjEal6Us3/m2dMd4LB45LcgkXU/Pyc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iW4yFrytzYlHVEkzvrlLBjCUjscKY+k45P9y6kjDUeeM1uImI4bcAiGqtvgcgaGliyFesPxuQIA1TiKXE561xWC+FqBPGg9cC7HHWzGGi5ATvwrExS5fm7rDEKiqsfVRt+99qOVe3jLhIJ5c4J3LNsOGS3tDj8IthdsSwQLDB/k= 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=xliVSeIp; arc=none smtp.client-ip=184.106.54.85 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="xliVSeIp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792698; bh=ATr+7wcRjGrL5BjEal6Us3/m2dMd4LB45LcgkXU/Pyc=; h=From:To:Subject:Date:From; b=xliVSeIpskenaTnmZyIALEI9f0hkqi/xM5pz6U29vs2SNnBpvLSXNG4Lr0MB0JP8s GFG6c2GtfSBoVx7XA8YIfhNTkw+KMOaD2s+hN2SMBGDZk1mSCZNR9atxNFVIL2ELPf In5BetXeleiLKOvxlwdKB0W6cFVsgeEkeMqcVzBU= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 9508C602F0; Fri, 30 Jan 2026 12:04:57 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 24/46] comedi: fl512: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:49 +0000 Message-ID: <20260130170416.49994-25-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-25-1 Content-Type: text/plain; charset="utf-8" The "fl512" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of an FL512 board. It currently allows any base address to be configured and uses a 16-byte register region. I cannot find any information about this board, but assume it needs to be aligned to a 16-byte boundary. I have no idea about the allowed range, so allow anything in a 32-bit range and add a "FIXME" comment (although most ancient ISA cards only support 10-bit address decoding). Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/dt282x.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/dt282x.c b/drivers/comedi/drivers/dt282= x.c index 4ae80e6c7266..29832e1f062d 100644 --- a/drivers/comedi/drivers/dt282x.c +++ b/drivers/comedi/drivers/dt282x.c @@ -1064,7 +1064,12 @@ static int dt282x_attach(struct comedi_device *dev, = struct comedi_devconfig *it) struct comedi_subdevice *s; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x10); + /* + * Although it has only 16 bytes (8 16-bit registers), it needs to + * start on a 32-byte boundary in range 0x200 to 0x3E0. + */ + ret =3D comedi_check_request_region(dev, it->options[0], 0x10, + 0x200, 0x3ff, 32); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp86.ord1d.emailsrvr.com (smtp86.ord1d.emailsrvr.com [184.106.54.86]) (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 05CB9359710 for ; Fri, 30 Jan 2026 17:04:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.86 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792701; cv=none; b=D42zBTS3XtHy3PvxV/lbQBDaml5SgCF9w8n4CkLbrjM/s3nsvBH41X2k2Fga1tq+zRMiCtCYlYW7IriBRJAFL4qk/yEND2rp88WtJCet73oodIHoqU+2BJtOwVnPDRMfF/u2kbuquaYd/IfBeWFbaZHKQyEcIPKlMafPHE1qaEw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792701; c=relaxed/simple; bh=uHMu7IhuuzzkEmakGjFVZw/equ2mKtVdw171aHn2PSM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PkngEJ0VPXEJfP7ohy3sVlmi7ujQ9EN3DGkV8s7HFGEVru8p2jkoG06DoUFp8TQB81M2Zywt3MHZxKwNZ/qX2xi18XQXtp2mCBx5SngynXOcDpSk6mq0vRu/vCiFJUAWk0pzNYOqAp2hH8/YkhCBsrT/Vds2S1vMaQrcvF3v1lg= 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=PQoQZgUo; arc=none smtp.client-ip=184.106.54.86 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="PQoQZgUo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792699; bh=uHMu7IhuuzzkEmakGjFVZw/equ2mKtVdw171aHn2PSM=; h=From:To:Subject:Date:From; b=PQoQZgUoLULx89GGyHScJ9UoHYDPx+fCbKphc82ibeBkEeHhXDDujIp4doQqweJOh FQrMw155OA1XAqaG5NELl8pNDEH4V1hrnJrd/DTW1KTMccREKNSa3UQBwwMbXCO465 iE9DlWdetPIWSSFbwQ6UgAOuamAn68nC9CqrYSNk= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 9928C601DE; Fri, 30 Jan 2026 12:04:58 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 25/46] comedi: mpc624: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:50 +0000 Message-ID: <20260130170416.49994-26-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-26-1 Content-Type: text/plain; charset="utf-8" The "mpc624" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a MPC624 board. 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 0x3F0 on 16-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/fl512.c | 8 +++++++- drivers/comedi/drivers/mpc624.c | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/comedi/drivers/fl512.c b/drivers/comedi/drivers/fl512.c index 139e801fc358..d9e6007556ac 100644 --- a/drivers/comedi/drivers/fl512.c +++ b/drivers/comedi/drivers/fl512.c @@ -98,9 +98,15 @@ static int fl512_ao_insn_write(struct comedi_device *dev, static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig= *it) { struct comedi_subdevice *s; + unsigned int iobase =3D it->options[0]; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x10); + /* + * FIXME: Don't know the allowed range, but assume it needs to be + * on a 16-byte boundary - Ian Abbott + */ + ret =3D comedi_check_request_region(dev, iobase, 0x10, + 0, UINT_MAX, 16); if (ret) return ret; =20 diff --git a/drivers/comedi/drivers/mpc624.c b/drivers/comedi/drivers/mpc62= 4.c index 9e51ff528ed1..e6343f4267c1 100644 --- a/drivers/comedi/drivers/mpc624.c +++ b/drivers/comedi/drivers/mpc624.c @@ -237,7 +237,8 @@ static int mpc624_attach(struct comedi_device *dev, str= uct comedi_devconfig *it) struct comedi_subdevice *s; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x10); + ret =3D comedi_check_request_region(dev, it->options[0], 0x10, + 0, 0x3ff, 16); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp85.ord1d.emailsrvr.com (smtp85.ord1d.emailsrvr.com [184.106.54.85]) (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 09CD7356A3B for ; Fri, 30 Jan 2026 17:05:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.85 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792702; cv=none; b=fQlSEMMYXkCZR16o4ROP/VK0a2J8KgQ6rQuxLthGjXKIeDAaNU9bBJzLqrmwHhNam1OnY7QWhs9KZsvvUzHpZiRT6/X8fhjNlEczvfbi/O4X6fjAQLpfgAsjHkYz8NhVyQUGbCKIBPC7hush8Fk/6MIEM1Fl+57Hpzwyg8s5i2o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792702; c=relaxed/simple; bh=M3fEKZYjOoARyYD74okbRHcLWAVCyxKYPDzop4e6tuc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EdIkoJIHNtMaKedQR3gsBC6DRqQKB/NrKQwwOOB3g4kQPyTwtu6bkfIs1imKLHy8RCVG8XTWOY1ud6VoCAX/JZMKcdmkZ4vhjCvWrAu/V0LLTHlWQAD+I9ly7L2q1Bk/ZexqdA98vmfLwELE4wPssm0RPUdvh1eS0GAyJ9gVE4Q= 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=Yb0ffG7R; arc=none smtp.client-ip=184.106.54.85 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="Yb0ffG7R" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792700; bh=M3fEKZYjOoARyYD74okbRHcLWAVCyxKYPDzop4e6tuc=; h=From:To:Subject:Date:From; b=Yb0ffG7RdtWbwNvFLBRjrHjivg5rXoaECCfv3EiGZeixLS+sQm2y+H2gHu3qncNYe oXPlj6xCWuSzG1ZyIPqjPHaw6ar7s8ru6Fw1Ll4P+mvqq5G3ThEd6xgm3Cd5rVfgGX h/uyEFMGfK0yaagXYU3Kv9vUHcBsaiuifIfnJABQ= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id A02B9602BD; Fri, 30 Jan 2026 12:04:59 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 26/46] comedi: multiq3: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:51 +0000 Message-ID: <20260130170416.49994-27-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-27-1 Content-Type: text/plain; charset="utf-8" The "multiq3" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a Multiq-3 board. 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 0x3F0 on 16-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/multiq3.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/multiq3.c b/drivers/comedi/drivers/mult= iq3.c index ac369e9a262d..3dde3a1876d7 100644 --- a/drivers/comedi/drivers/multiq3.c +++ b/drivers/comedi/drivers/multiq3.c @@ -259,7 +259,8 @@ static int multiq3_attach(struct comedi_device *dev, int ret; int i; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x10); + ret =3D comedi_check_request_region(dev, it->options[0], 0x10, + 0, 0x3ff, 16); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 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 1172E37648A for ; Fri, 30 Jan 2026 17:05:01 +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=1769792704; cv=none; b=SRao1to59zY9t07kYKodZ8I+t0diqx5RMBONaywMkfBiRHlLdxE/qaxF/tF+4C2nTK3qXAItQDS5NEI/o/s4vFhrNQ1NGxW34YhmOopKDNAQFeRlxfjOa31McKQUbYctWwgkkUIiW6ZeZjAXcWN1TQ9IRXhlkpSpAvarMOwGk4E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792704; c=relaxed/simple; bh=BoSAf/nPeMGqA2+lvXjR714pUehq6Kfv2DBCQ2rU/iw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ErMzCmGBdtx9X2BBcO5lselO/iOY5vKAgbbGKEI6Q+/L/H/f92YMDZu/ieGVU73QZTXtRJZxQcx+bVzshe4gtTux+6SaXTqviipbd41QEK8exq/l060DnmK6rz8ie7pvwK0N5aVigkuPe1mZcBbRhIKuInK6awlSONYmILGChdM= 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=Sh5plknF; 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="Sh5plknF" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792701; bh=BoSAf/nPeMGqA2+lvXjR714pUehq6Kfv2DBCQ2rU/iw=; h=From:To:Subject:Date:From; b=Sh5plknFVHul9QxgbZMO37Nf4GmtZJVQvtqoOdYUO8ABJHl849HKHFJvYeZUvauFt pN4o43HCFlXpOfJEx/HCKYhZCCTGMipG7stAzh5S4z/0TRrBOYu0wc9VhIBKTp9DTr 1RdNwP9VXXBjbNwau8ZaorMdDyGLAZ+8VsuxA5Ws= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id A679460300; Fri, 30 Jan 2026 12:05:00 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 27/46] comedi: ni_at_a2150: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:52 +0000 Message-ID: <20260130170416.49994-28-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-28-1 Content-Type: text/plain; charset="utf-8" The "ni_at_a2150" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of an AT-A2150 series board. 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 0x3E0 on 32-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/ni_at_a2150.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/ni_at_a2150.c b/drivers/comedi/drivers/= ni_at_a2150.c index e4e5a0ebd195..44221c928e32 100644 --- a/drivers/comedi/drivers/ni_at_a2150.c +++ b/drivers/comedi/drivers/ni_at_a2150.c @@ -694,7 +694,8 @@ static int a2150_attach(struct comedi_device *dev, stru= ct comedi_devconfig *it) if (!devpriv) return -ENOMEM; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x1c); + ret =3D comedi_check_request_region(dev, it->options[0], 0x1c, + 0, 0x3ff, 32); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 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 F28D135EDBD for ; Fri, 30 Jan 2026 17:05:02 +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=1769792705; cv=none; b=RFRHyfWzw0uAZ5P+WBAAmpxijfolblH7dbBkx22ptlfpE6C+UwQgVrv6jT1She+2ctC+fv6lvJbt2KuwfbumWt5ZGBwWZVHBwoo3ck1PntttkABer/PsLT4HonBJXTzBMA/kBNnEkz8Lo5PRMJ/vugPTVl5jqg2Nll7g2/ZlAFU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792705; c=relaxed/simple; bh=i2SHz7GRivjXF1RliW16P3Wj8xV/XICoTYPN7jquaWM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UoyCInQz/U6P/MuY6lvSUscKg4YiA/SKnT6XjzX3x387sxxn26QQu0Mc6iS6899JZo7y+VlT9nZFuT79olDkoc2Rf1KVVS0DSxF4NCXcUmUAdXzWvh/dkcjc6/7HaJ711AEXxpWja8DQ4/xmAPzV1lUhH6xqQjDwBlQ/B3+/M/I= 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=q6Pgq0ke; 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="q6Pgq0ke" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792702; bh=i2SHz7GRivjXF1RliW16P3Wj8xV/XICoTYPN7jquaWM=; h=From:To:Subject:Date:From; b=q6Pgq0kefGX2Wy8kz2byOrR/8DZwTUWCU4i6argesOKYbw6uxVWbY4PAN+udTtJXh ziIzC9iwrTfm0TqfQsEiY80hiTcAbTcEPrM4jxq8qhnIHhfaZUnDF8uOx2/DGR2DK8 JZeQtxVP434tEYl7dxKfmMWySj9iW3ZZ9J37+uIs= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id AD3D4602F0; Fri, 30 Jan 2026 12:05:01 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 28/46] comedi: ni_at_ao: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:53 +0000 Message-ID: <20260130170416.49994-29-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-29-1 Content-Type: text/plain; charset="utf-8" The "ni_at_ao" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of an AT-AO-6 or AT-AO-10 board. 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 0x3E0 on 32-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/ni_at_ao.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/ni_at_ao.c b/drivers/comedi/drivers/ni_= at_ao.c index 9cf6b4ff6b65..31fd64bf8206 100644 --- a/drivers/comedi/drivers/ni_at_ao.c +++ b/drivers/comedi/drivers/ni_at_ao.c @@ -295,7 +295,8 @@ static int atao_attach(struct comedi_device *dev, struc= t comedi_devconfig *it) struct comedi_subdevice *s; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x20); + ret =3D comedi_check_request_region(dev, it->options[0], 0x20, + 0, 0x3ff, 32); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp84.ord1d.emailsrvr.com (smtp84.ord1d.emailsrvr.com [184.106.54.84]) (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 5295535FF4C for ; Fri, 30 Jan 2026 17:05:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.84 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792705; cv=none; b=UzM347t4CJ/rYTRb6u9ZyzL32IhTLCgkad0LtQ5OW3zC5jll0pYcAk5ekMypbhpb6KIkOLo+iOrK4Wrk0CjDxmhGSYDZf+/klv5Q4IVRhmxJOMc+nr9Legu78rhC+UOIqjomVOv9mprqALlWrS8DLa30Ng3AY96HmvDq7QChn64= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792705; c=relaxed/simple; bh=7eauUzvIwpLCLqUmh7dyF6lbv5FWjS6Wk5t+smd8IVE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q00Z6ryJAE2jaVJt9rJH2OraFYJIado3a1ZUCRv67c7BrDbu5NgM2+eUdYmRmWvgX92JHCBZS7H1hwth1Zr35WYXx/jXXKOQiWcODGMfpWmnOy+uR/vTpBQd/dOMzi2VFbrt2oz2ThAlCrMTPJlkk+Cc61ffdV4hAoSdjX6dQwc= 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=GOKTuJT4; arc=none smtp.client-ip=184.106.54.84 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="GOKTuJT4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792703; bh=7eauUzvIwpLCLqUmh7dyF6lbv5FWjS6Wk5t+smd8IVE=; h=From:To:Subject:Date:From; b=GOKTuJT4rqQDyV5KBqAacieIjF9k2sLB58He72wCLeVUmfxw8S02WO2+Pu/t8PXsZ YyqkyI/LLkLBSaumvaFqSf4wqC95tZ1jTwniD1effQy2NIAd9nB+LusEh26INx8Yz5 djNmbM8fl5hQWXXL6J8IBiIQXSBOCT2j1pzcEJG4= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id B2B8A601DE; Fri, 30 Jan 2026 12:05:02 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 29/46] comedi: ni_atmio: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:54 +0000 Message-ID: <20260130170416.49994-30-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-30-1 Content-Type: text/plain; charset="utf-8" The "ni_atmio" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of an AT E Series board. Or, if the option value is zero, it can search ISA PNP devices to look for a compatible board. If the base address is configured manually, it currently allows any base address to be configured but the hardware only supports base addresses (configured by a configuration utility and stored in nonvolatile memory) in the range 0x20 to 0xFFE0 on 32-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/ni_atmio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/ni_atmio.c b/drivers/comedi/drivers/ni_= atmio.c index b4e759e5703f..7bc336333ace 100644 --- a/drivers/comedi/drivers/ni_atmio.c +++ b/drivers/comedi/drivers/ni_atmio.c @@ -311,7 +311,8 @@ static int ni_atmio_attach(struct comedi_device *dev, comedi_set_hw_dev(dev, &isapnp_dev->dev); } =20 - ret =3D comedi_request_region(dev, iobase, 0x20); + ret =3D comedi_check_request_region(dev, iobase, 0x20, + 0x20, 0xffff, 32); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 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 083E73587D2 for ; Fri, 30 Jan 2026 17:05:04 +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=1769792706; cv=none; b=TlaA7bGP+M9zatTc151glFEs5eGQ3Mg9S0D3FcFLi7f4azFx8/jkilcrfBKrXGoY04vdv5J62JW5T63qlM/JTv23GkK6/YbWMipCk457sMVVFZW32CT3e8QbM6HNwX+Jj4I19SogudBFt6aDeE/X4GsVGvewA7JbtDmGJZtn0Z4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792706; c=relaxed/simple; bh=8L/gkQk+lONxjth89LkXmrpUT5ZwI5tfZZTejOi7OHc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eEUKoVYchHpx+7dRDbbLpewekSxTai4Z1GMucmAsWprhkraEZkl3gbGF0pdTRjpHbRx7h40oIVsxBaxnYYYYihw4enIFKHrmQB3/z3XPWRGsWxylWPokZrqqT0Zvfd0saiyoFnWDwWtuZjtGwY2MBujzFF73mq18ZlpILn/W68A= 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=DnksMW+b; 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="DnksMW+b" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792704; bh=8L/gkQk+lONxjth89LkXmrpUT5ZwI5tfZZTejOi7OHc=; h=From:To:Subject:Date:From; b=DnksMW+bzkT9BJxALtaIG6kpdxRHdPDwMiK4CSVMm0Sks5WXbVWPjfLtNUAB/oe4I +RZuELjgcsQRR+M5avjd1N4qjuneZRMKT76CrAaBQnCAi5dxidPi9NbqvN4MaaeXjk t2zi7Gy1tzl6s/IutMTSaW4oodKZpGkR3UnsrpEA= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id B7A99602BD; Fri, 30 Jan 2026 12:05:03 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 30/46] comedi: ni_atmio16d: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:55 +0000 Message-ID: <20260130170416.49994-31-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-31-1 Content-Type: text/plain; charset="utf-8" The "ni_atmio16d" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of an AT-MIO-16 o AT-MIO-16D board. It currently allows any base address to be configured but the hardware only supports base addresses (configured by on-board DIP switches) in the range 0 to 0x3E0 on 32-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/ni_atmio16d.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/ni_atmio16d.c b/drivers/comedi/drivers/= ni_atmio16d.c index e5e7cc423c87..cefa39b5077c 100644 --- a/drivers/comedi/drivers/ni_atmio16d.c +++ b/drivers/comedi/drivers/ni_atmio16d.c @@ -574,7 +574,8 @@ static int atmio16d_attach(struct comedi_device *dev, struct comedi_subdevice *s; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x20); + ret =3D comedi_check_request_region(dev, it->options[0], 0x20, + 0, 0x3ff, 32); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 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 3B48037F101 for ; Fri, 30 Jan 2026 17:05:06 +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=1769792707; cv=none; b=rbYGJXQyF0z05LHlWnLdMGaqgA1KpCQg8ythmxMx2XDXVqbcSImLqd0nISoIv2dEMVx0xo65GQpQuD9FNXs9JpP7jAn1VQ4MqlYUEqYhC6qBvtL3o2ho5sjc9HFA/9fWVCUKoQVllj7WI6PlwZxb0Q489cqU9kCV3hhVRO9GX3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792707; c=relaxed/simple; bh=6cMcencm5USbxlQ1Iu5b7Lv+bYDJXQLAK/l1PP5HXV8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F+pkcmVDGR2mCy1vc0qfeKa5HBIgeQBW9IZFoVxHPQgCWpP1zakQeYo64OQJ4wsfRCbNsjZQJ24ShRCb3ey5IlFsAKYVai6/EitCr8vrHv1gHqdsgipb/hkQKf9F/S/W4/Hl7klyOEw8AFpSrQQT2FA56lppHxgnflrdfxjvzEA= 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=ZYw4z76l; 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="ZYw4z76l" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792705; bh=6cMcencm5USbxlQ1Iu5b7Lv+bYDJXQLAK/l1PP5HXV8=; h=From:To:Subject:Date:From; b=ZYw4z76lWtISI5af/4OogO9C+tkwrMTOK/J79cRmYA1iKcf3zmevOA++Sbn3F6hpc XaPh6VUSjTVGxr0Vpp38A3I0cTMQgvKpaZxcxdtjyqsW02ad+G2+7pQUizvy5appVv 140lbLZmnWS9dGDWbWkwJJyA3mz33q+kz543sHZo= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id BC397602FA; Fri, 30 Jan 2026 12:05:04 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 31/46] comedi: ni_labpc: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:56 +0000 Message-ID: <20260130170416.49994-32-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-32-1 Content-Type: text/plain; charset="utf-8" The "ni_labpc" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a Lab-PC-1200 series or Lab-PC+ board. It currently allows any base address to be configured but the hardware only supports base addresses (configured by a configuration utility and stored in nonvolatile memory) in the range 0 to 0x3E0 on 32-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/ni_labpc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/ni_labpc.c b/drivers/comedi/drivers/ni_= labpc.c index b25a8e117072..93b5333a99b5 100644 --- a/drivers/comedi/drivers/ni_labpc.c +++ b/drivers/comedi/drivers/ni_labpc.c @@ -78,7 +78,8 @@ static int labpc_attach(struct comedi_device *dev, struct= comedi_devconfig *it) unsigned int dma_chan =3D it->options[2]; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x20); + ret =3D comedi_check_request_region(dev, it->options[0], 0x20, + 0, 0x3ff, 32); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp83.ord1d.emailsrvr.com (smtp83.ord1d.emailsrvr.com [184.106.54.83]) (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 816C437F0E9 for ; Fri, 30 Jan 2026 17:05:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.83 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792709; cv=none; b=ccIAqlLVnCzgUUn442Hfp7nSacwRKUn7WB08TjwkfQ7LBKZnZ/dtG7zLna2Cc2becm/slib5cNyO2Xet+oMsjmlJiLFZckaymOj/4s8TEqtIZ+Qvn9UMwA2ApigP8oOUXXq5QepscKYdvmbq4/bvEwiL5v4j/xGCVi6Fwlf797A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792709; c=relaxed/simple; bh=fxEwahVI6Ji0xyOvSQ1R2gk+BAwRaoAGlWRP3pA13Gw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QTa3P/+hRkjA1WHSmJvpJZxpEE/6JSJfkSQPZsVo+XQBGDXEzpEHKLs39x6khaPHkbQc4nXrqB89XnO8MDwbFlJybEcLQ5STrX0aX64LdfHcmOYudfAWO0LnVIx4GYEk6lQvl0iID4674QZVl1tOJwBaJ5GmTfeOfJiwLoUKCV4= 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=sMnsu2vO; arc=none smtp.client-ip=184.106.54.83 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="sMnsu2vO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792706; bh=fxEwahVI6Ji0xyOvSQ1R2gk+BAwRaoAGlWRP3pA13Gw=; h=From:To:Subject:Date:From; b=sMnsu2vOMR6Q/KCxqyZ4NH8TmwcOjnmK9Cp3Y6BdcYyCeDwk+A/dbBEI0n2LLQ2HW kANhziPOIaHH3HjwEgTIiOKDrUR6DQbBovK50K0sxAk5Muv4Dh3NtSiaScbk0Fzuu3 A0+AeWKqC6LiRyY0i3hy/L4K3DmqD8vf8+qM565w= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id C03D4601DE; Fri, 30 Jan 2026 12:05:05 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 32/46] comedi: pcl711: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:57 +0000 Message-ID: <20260130170416.49994-33-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-33-1 Content-Type: text/plain; charset="utf-8" The "pcl711" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of an Advantech PCL-711 series board or an Adlink ACL-8112 series board. It currently allows any base address to be configured but the hardware only supports base addresses (configured by on-board DIP switches) in the range 0 to 0x3F0 (for PCL-711) or 0x200 to 0x3F0 (for ACL-8112) on 16-byte boundaries. Store the minimum supported I/O base address in the static board information array elements, and add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/pcl711.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/pcl711.c b/drivers/comedi/drivers/pcl71= 1.c index 0cf3917defe7..5d2c4b2aa3bb 100644 --- a/drivers/comedi/drivers/pcl711.c +++ b/drivers/comedi/drivers/pcl711.c @@ -112,6 +112,7 @@ struct pcl711_board { int n_aichan; int n_aochan; int maxirq; + unsigned int min_io_start; const struct comedi_lrange *ai_range_type; }; =20 @@ -132,12 +133,14 @@ static const struct pcl711_board boardtypes[] =3D { .n_aichan =3D 16, .n_aochan =3D 2, .maxirq =3D 15, + .min_io_start =3D 0x200, .ai_range_type =3D &range_acl8112hg_ai, }, { .name =3D "acl8112dg", .n_aichan =3D 16, .n_aochan =3D 2, .maxirq =3D 15, + .min_io_start =3D 0x200, .ai_range_type =3D &range_acl8112dg_ai, }, }; @@ -418,7 +421,8 @@ static int pcl711_attach(struct comedi_device *dev, str= uct comedi_devconfig *it) struct comedi_subdevice *s; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x10); + ret =3D comedi_check_request_region(dev, it->options[0], 0x10, + board->min_io_start, 0x3ff, 16); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp83.ord1d.emailsrvr.com (smtp83.ord1d.emailsrvr.com [184.106.54.83]) (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 4C4BF3559F2 for ; Fri, 30 Jan 2026 17:05:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.83 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792709; cv=none; b=Uqs0XYEN/hnJY0Koeghu9JoDoaPxnXBy9edJIPrd7p2hLhxVio5jgIJmPAR8nV2Gau1AqRPuL1FcM25gTdlfFQelkkFFWILLjp5f/b9K4XS3N6kJkriLrf3v3DJaR0/C3PdP4kgibIErfEjbtpVb3/M6y6b3M7LN8B6zJM/0wQA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792709; c=relaxed/simple; bh=aikxMto30aKxnQ2fcJ0Z+x32eDcOY9pJFTrxrqSgj8g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Vv1Fdp0WdTqLPWwwK42bVOIQQAE4QOZZAKIvwhSfnkDf1wdLSAzB+E/UATtTJoQgeqUEsw8JGBxbGaTKllVBr+z6+kZWjq+xxHu3nYq48eh7InFY2whfwjvQMA2vFdNkkCshuzzSr5QIcweXR25mgfkYKFPsWWKV2+uslIBpOtA= 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=pGEZsFKw; arc=none smtp.client-ip=184.106.54.83 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="pGEZsFKw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792707; bh=aikxMto30aKxnQ2fcJ0Z+x32eDcOY9pJFTrxrqSgj8g=; h=From:To:Subject:Date:From; b=pGEZsFKwMcYKPNmk9MyHEvMdT10t4DEwwNZfgnkUg2n3Nz5WHnL+bjxIE9lq+mPPk WZfzqt0dUvIufV+EemcFqPPvwy8bmBPWOkEYA0V/VzyqVvls8bxSlIoPwC0TGE61O+ Sf4AY3dxHDR+V2ZB6XQzM3FFAaS94rzvaFKCYGt4= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id C647A602BD; Fri, 30 Jan 2026 12:05:06 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 33/46] comedi: pcl724: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:58 +0000 Message-ID: <20260130170416.49994-34-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-34-1 Content-Type: text/plain; charset="utf-8" The "pcl724" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of various 8255 chip-based digital I/O ISA boards from Advantech, ADLINK, WinSystems, and Diamond Systems. It currently allows any base address to be configured but the hardware only supports base addresses (configured by on-board DIP switches or jumpers) in various ranges, and on various alignment boundaries, depending on the model. Store the minimum and maximum supported I/O address ranges in the static board information array elements (the required alignment is already stored in the `io_range` member), and add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/pcl724.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/pcl724.c b/drivers/comedi/drivers/pcl72= 4.c index 00474710b81f..9707d0c89304 100644 --- a/drivers/comedi/drivers/pcl724.c +++ b/drivers/comedi/drivers/pcl724.c @@ -31,6 +31,8 @@ struct pcl724_board { const char *name; unsigned int io_range; + unsigned int min_io_start; + unsigned int max_io_end; unsigned int can_have96:1; unsigned int is_pet48:1; int numofports; @@ -40,37 +42,53 @@ static const struct pcl724_board boardtypes[] =3D { { .name =3D "pcl724", .io_range =3D 0x04, + .min_io_start =3D 0x200, + .max_io_end =3D 0x3ff, .numofports =3D 1, /* 24 DIO channels */ }, { .name =3D "pcl722", .io_range =3D 0x20, + .min_io_start =3D 0x200, + .max_io_end =3D 0x3ff, .can_have96 =3D 1, .numofports =3D 6, /* 144 (or 96) DIO channels */ }, { .name =3D "pcl731", .io_range =3D 0x08, + .min_io_start =3D 0, + .max_io_end =3D 0x3ff, .numofports =3D 2, /* 48 DIO channels */ }, { .name =3D "acl7122", .io_range =3D 0x20, + .min_io_start =3D 0x200, + .max_io_end =3D 0x3ff, .can_have96 =3D 1, .numofports =3D 6, /* 144 (or 96) DIO channels */ }, { .name =3D "acl7124", .io_range =3D 0x04, + .min_io_start =3D 0x200, + .max_io_end =3D 0x3ff, .numofports =3D 1, /* 24 DIO channels */ }, { .name =3D "pet48dio", .io_range =3D 0x02, + .min_io_start =3D 0, + .max_io_end =3D 0x3ff, .is_pet48 =3D 1, .numofports =3D 2, /* 48 DIO channels */ }, { .name =3D "pcmio48", .io_range =3D 0x08, + .min_io_start =3D 0x100, + .max_io_end =3D 0x17f, .numofports =3D 2, /* 48 DIO channels */ }, { .name =3D "onyx-mm-dio", .io_range =3D 0x10, + .min_io_start =3D 0, + .max_io_end =3D 0x3ff, .numofports =3D 2, /* 48 DIO channels */ }, }; @@ -112,7 +130,9 @@ static int pcl724_attach(struct comedi_device *dev, n_subdevices =3D 4; } =20 - ret =3D comedi_request_region(dev, it->options[0], iorange); + ret =3D comedi_check_request_region(dev, it->options[0], iorange, + board->min_io_start, + board->max_io_end, iorange); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp84.ord1d.emailsrvr.com (smtp84.ord1d.emailsrvr.com [184.106.54.84]) (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 3D71437F8BA for ; Fri, 30 Jan 2026 17:05:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.84 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792710; cv=none; b=No8jE2n9SucDUgH7t/Z3pxNJB9DbXnjrZ3k6AqD26ojXpL8OTq2qRuNUGPB/U044BXDXd91jm8801WWJx4s/FJyHAY/vF599yLKYIPJtgoBLhqHMD5+UxUTWpUq43wy+af5ilGQD0iReXrXFX2tpQhA9oGSDIm2l3U54cRkzH5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792710; c=relaxed/simple; bh=i+GShduNbaTWAXGEOAhl55cCUyBsNKcW18AGkx5o7Sc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KaZn5zrjMnJcn4kLsY60mynx/VCHLt3P7e2TaftE398JgjLr5VW4AApCYry4+0n91xchs52rMRe6FcrW/SIk+dwHz30nfLICSY31Ornblwm+tIbjPzfLvl51rO/HDoYMdREHLT7mONUZaO6JWKKjaxiootW7EolKyQkuAGshdlg= 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=D33B3WxC; arc=none smtp.client-ip=184.106.54.84 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="D33B3WxC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792708; bh=i+GShduNbaTWAXGEOAhl55cCUyBsNKcW18AGkx5o7Sc=; h=From:To:Subject:Date:From; b=D33B3WxC3GIisG79EbnRxxho478pEDhRz7E5BCsbsEPSv7fFkrVwNwZztEStU4cta pVsAB+DUS7DFa/7FUkHafrrNdE3HREXnTgmzwddHsLG8Tc6KBVkCjtySIhOQyfX6Il z+G/tC25HzW2xFslooLRchN6gc9KNjKGVxGbCFKY= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id D08D5602FB; Fri, 30 Jan 2026 12:05:07 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 34/46] comedi: pcl726: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:59 +0000 Message-ID: <20260130170416.49994-35-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-35-1 Content-Type: text/plain; charset="utf-8" The "pcl726" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of various analog output ISA boards from Advantech (PCL-726/727/728) and ADLINK (ACL-6126/6128). (Most of them also have digital I/O.) It currently allows any base address to be configured but the hardware only supports base addresses (configured by on-board DIP switches) from 0 or 0x200 up to nearly 0x3FF, depending on the model. Store the minimum and maximum supported I/O address ranges in the static board information array elements (the required alignment is already stored in the `io_len` member), and add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/pcl726.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/comedi/drivers/pcl726.c b/drivers/comedi/drivers/pcl72= 6.c index b542896fa0e4..d3b1f4388643 100644 --- a/drivers/comedi/drivers/pcl726.c +++ b/drivers/comedi/drivers/pcl726.c @@ -91,7 +91,8 @@ static const struct comedi_lrange *const rangelist_728[] = =3D { =20 struct pcl726_board { const char *name; - unsigned long io_len; + unsigned int io_len; + unsigned int min_io_start; unsigned int irq_mask; const struct comedi_lrange *const *ao_ranges; int ao_num_ranges; @@ -104,6 +105,7 @@ static const struct pcl726_board pcl726_boards[] =3D { { .name =3D "pcl726", .io_len =3D 0x10, + .min_io_start =3D 0x200, .ao_ranges =3D &rangelist_726[0], .ao_num_ranges =3D ARRAY_SIZE(rangelist_726), .ao_nchan =3D 6, @@ -111,6 +113,7 @@ static const struct pcl726_board pcl726_boards[] =3D { }, { .name =3D "pcl727", .io_len =3D 0x20, + .min_io_start =3D 0x200, .ao_ranges =3D &rangelist_727[0], .ao_num_ranges =3D ARRAY_SIZE(rangelist_727), .ao_nchan =3D 12, @@ -119,12 +122,14 @@ static const struct pcl726_board pcl726_boards[] =3D { }, { .name =3D "pcl728", .io_len =3D 0x08, + .min_io_start =3D 0, .ao_num_ranges =3D ARRAY_SIZE(rangelist_728), .ao_ranges =3D &rangelist_728[0], .ao_nchan =3D 2, }, { .name =3D "acl6126", .io_len =3D 0x10, + .min_io_start =3D 0x200, .irq_mask =3D 0x96e8, .ao_num_ranges =3D ARRAY_SIZE(rangelist_726), .ao_ranges =3D &rangelist_726[0], @@ -133,6 +138,7 @@ static const struct pcl726_board pcl726_boards[] =3D { }, { .name =3D "acl6128", .io_len =3D 0x08, + .min_io_start =3D 0, .ao_num_ranges =3D ARRAY_SIZE(rangelist_728), .ao_ranges =3D &rangelist_728[0], .ao_nchan =3D 2, @@ -316,7 +322,9 @@ static int pcl726_attach(struct comedi_device *dev, int ret; int i; =20 - ret =3D comedi_request_region(dev, it->options[0], board->io_len); + ret =3D comedi_check_request_region(dev, it->options[0], board->io_len, + board->min_io_start, 0x3ff, + board->io_len); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp86.ord1d.emailsrvr.com (smtp86.ord1d.emailsrvr.com [184.106.54.86]) (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 82B8F35B134 for ; Fri, 30 Jan 2026 17:05:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.86 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792712; cv=none; b=Tv3qch+t30h8SuPLa+dW3yeb2l6LCTmhrR4E3AkVoPQX5R13SCql6V2mdw4PO1zvp/PxzGHUXbsKwCgTVQ3CFy9zYZWHZgJ+HU3R/TUNaY7biJBN++ZuuWaBvAGAVjX0DR4wGlXjeAMYuvuHj25IWeOiRMbJv17Y1UkOHoFFZJA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792712; c=relaxed/simple; bh=MfzuQ8imMk4RLujxm0/Ic8A6iaTtbqCYJGloXprnP6U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ma2B7fz6DU8MkOKNsTxoXNO3XgwXktBedepI3eNrlG+Sea16/u9WG+ceqclRXp3jea9kWton1t0f2fcXfRVTvSTc9Ii1LM3aT8gcmcJCSnDdnIm34s6w47KTUFaTsclk1O8HDWu3Km4OMMMw/Xr4ogTgzX4qqwWvqG4Fz3Dm3Eg= 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=PxDigfAC; arc=none smtp.client-ip=184.106.54.86 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="PxDigfAC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792709; bh=MfzuQ8imMk4RLujxm0/Ic8A6iaTtbqCYJGloXprnP6U=; h=From:To:Subject:Date:From; b=PxDigfACaLWJt+7s69EMNtUpr+w7UkREYZMnzSOWQWpr6nt3lJ0Ddc5PYVh8QTYMv ZHaDrrbfYjz9XVA0KiWxU3vBLowxvu5Dc0WzIzi4cv9FYoqmZ5eClkYb5O4SIJxy2l jkOVq+lZjFFjbBg/DBTTzAh0bLFWOqsEftZOm4ZI= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id D74B4602A3; Fri, 30 Jan 2026 12:05:08 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 35/46] comedi: pcl730: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:48:00 +0000 Message-ID: <20260130170416.49994-36-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-36-1 Content-Type: text/plain; charset="utf-8" The "pcl730" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of various relay output and digital input ISA board from Advantech, ADLINK, ICP DAS, and Diamond Systems. It currently allows any base address to be configured but the hardware devices have restrictions on the base addresses (configured by on-board DIP switches or jumpers), including the alignment, which can be larger than the board's I/O register address span. The Diamond Systems IR104-PBF board is particularly restricted to 4 different base addresses with different sized gaps between the possible addresses. Store the minimum supported I/O base addresses and alignment in the static board information array elements and add a sanity check to ensure the device is not configured at an unsupported base address. For the IR104-PBF board, add a special check that the base address is one of the 4 supported base addresses for that board. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/pcl730.c | 49 +++++++++++++++++++++++++++++++-- 1 file changed, 47 insertions(+), 2 deletions(-) diff --git a/drivers/comedi/drivers/pcl730.c b/drivers/comedi/drivers/pcl73= 0.c index d2733cd5383d..cf0f97b6e2c0 100644 --- a/drivers/comedi/drivers/pcl730.c +++ b/drivers/comedi/drivers/pcl730.c @@ -101,7 +101,9 @@ =20 struct pcl730_board { const char *name; - unsigned int io_range; + unsigned short io_range; + unsigned short min_io_start; + unsigned short align_io_start; unsigned is_pcl725:1; unsigned is_acl7225b:1; unsigned is_ir104:1; @@ -117,6 +119,8 @@ static const struct pcl730_board pcl730_boards[] =3D { { .name =3D "pcl730", .io_range =3D 0x04, + .min_io_start =3D 0, + .align_io_start =3D 0x04, .has_ttl_io =3D 1, .n_subdevs =3D 4, .n_iso_out_chan =3D 16, @@ -125,6 +129,8 @@ static const struct pcl730_board pcl730_boards[] =3D { }, { .name =3D "iso730", .io_range =3D 0x04, + .min_io_start =3D 0, + .align_io_start =3D 0x04, .n_subdevs =3D 4, .n_iso_out_chan =3D 16, .n_iso_in_chan =3D 16, @@ -132,6 +138,8 @@ static const struct pcl730_board pcl730_boards[] =3D { }, { .name =3D "acl7130", .io_range =3D 0x08, + .min_io_start =3D 0x200, + .align_io_start =3D 0x08, .has_ttl_io =3D 1, .n_subdevs =3D 4, .n_iso_out_chan =3D 16, @@ -140,6 +148,8 @@ static const struct pcl730_board pcl730_boards[] =3D { }, { .name =3D "pcm3730", .io_range =3D 0x04, + .min_io_start =3D 0, + .align_io_start =3D 0x04, .has_ttl_io =3D 1, .n_subdevs =3D 4, .n_iso_out_chan =3D 8, @@ -148,6 +158,8 @@ static const struct pcl730_board pcl730_boards[] =3D { }, { .name =3D "pcl725", .io_range =3D 0x02, + .min_io_start =3D 0x200, + .align_io_start =3D 0x02, .is_pcl725 =3D 1, .n_subdevs =3D 2, .n_iso_out_chan =3D 8, @@ -155,6 +167,8 @@ static const struct pcl730_board pcl730_boards[] =3D { }, { .name =3D "p8r8dio", .io_range =3D 0x02, + .min_io_start =3D 0, + .align_io_start =3D 0x10, .is_pcl725 =3D 1, .has_readback =3D 1, .n_subdevs =3D 2, @@ -163,6 +177,8 @@ static const struct pcl730_board pcl730_boards[] =3D { }, { .name =3D "acl7225b", .io_range =3D 0x08, /* only 4 are used */ + .min_io_start =3D 0x200, + .align_io_start =3D 0x08, .is_acl7225b =3D 1, .has_readback =3D 1, .n_subdevs =3D 2, @@ -171,6 +187,8 @@ static const struct pcl730_board pcl730_boards[] =3D { }, { .name =3D "p16r16dio", .io_range =3D 0x04, + .min_io_start =3D 0, + .align_io_start =3D 0x08, .is_acl7225b =3D 1, .has_readback =3D 1, .n_subdevs =3D 2, @@ -179,16 +197,22 @@ static const struct pcl730_board pcl730_boards[] =3D { }, { .name =3D "pcl733", .io_range =3D 0x04, + .min_io_start =3D 0, + .align_io_start =3D 0x04, .n_subdevs =3D 1, .n_iso_in_chan =3D 32, }, { .name =3D "pcl734", .io_range =3D 0x04, + .min_io_start =3D 0, + .align_io_start =3D 0x04, .n_subdevs =3D 1, .n_iso_out_chan =3D 32, }, { .name =3D "opmm-1616-xt", .io_range =3D 0x10, + .min_io_start =3D 0x100, + .align_io_start =3D 0x10, .is_acl7225b =3D 1, .has_readback =3D 1, .n_subdevs =3D 2, @@ -197,11 +221,15 @@ static const struct pcl730_board pcl730_boards[] =3D { }, { .name =3D "pearl-mm-p", .io_range =3D 0x02, + .min_io_start =3D 0x240, + .align_io_start =3D 0x40, .n_subdevs =3D 1, .n_iso_out_chan =3D 16, }, { .name =3D "ir104-pbf", .io_range =3D 0x08, + .min_io_start =3D 0x240, + .align_io_start =3D 0x20, .is_ir104 =3D 1, .has_readback =3D 1, .n_iso_out_chan =3D 20, @@ -266,10 +294,27 @@ static int pcl730_attach(struct comedi_device *dev, { const struct pcl730_board *board =3D dev->board_ptr; struct comedi_subdevice *s; + unsigned int iobase =3D it->options[0]; int subdev; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], board->io_range); + if (board->is_ir104) { + switch (iobase) { + case 0x240: + case 0x260: + case 0x280: + case 0x300: + break; + default: + dev_warn(dev->class_dev, + "%s: unsupported I/O base address %#x\n", + dev->board_name, iobase); + return -EINVAL; + } + } + ret =3D comedi_check_request_region(dev, iobase, board->io_range, + board->min_io_start, 0x3ff, + board->align_io_start); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp87.ord1d.emailsrvr.com (smtp87.ord1d.emailsrvr.com [184.106.54.87]) (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 4768F37FF79 for ; Fri, 30 Jan 2026 17:05:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.87 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792712; cv=none; b=Hp0QOheY8Wp38NIk9OidXKND6wU98D2tZf7vFP2lH6Gy7qvzVUzHeoa159DcaC+0tW1AWfr/ii/0D4QW+vwNIq/+B1bHrQoLUJNc6ipJ2RS0N4Exd/EC8jL/Fbz1J/fAk21wRGWBS68y3aNgN6nviIHQBrotFoLeZAQlZ4Aoyn8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792712; c=relaxed/simple; bh=YErWSHZK9FACt2U+YMq201b1VDVnCTcwpZjmz3Wxgtw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KY8me7zIDpPhuQ0j+yYZNYr0zXcO6i14B1QhwPApKr//sPYb2CbztjFLLgWJchN8269o1XmHKYRdonmzT8sMgzx4RXnMuCN2CWnWG6ReTgK8rymeWQqgTQgN4XEJSZrfEHt0s0iZKAzNbUPgZfLvG1E+PCzXUgiFqBd9cLM6j18= 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=tU9BqrLZ; arc=none smtp.client-ip=184.106.54.87 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="tU9BqrLZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792710; bh=YErWSHZK9FACt2U+YMq201b1VDVnCTcwpZjmz3Wxgtw=; h=From:To:Subject:Date:From; b=tU9BqrLZ0Dm6na1jOGhdsmlVWi1UwjC5JbHDeYJoRTrXNUbT0uj9OTU8amvPlH+Tq 5oAayx4vLR6TYcBG2waXvwQS9PEj0Vy2DaMZAbqo0VnEuk3zC/b3b7c0kjxLsCaOR6 vp2e86wvD6Cf6yPHYf8W1lL85AEg5jk9eTO0t88M= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id DF612601DE; Fri, 30 Jan 2026 12:05:09 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 36/46] comedi: pcl812: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:48:01 +0000 Message-ID: <20260130170416.49994-37-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-37-1 Content-Type: text/plain; charset="utf-8" The "pcl812" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of various analog/digital I/O ISA boards from Advantech, ADLINK, and ICP DAS. It currently allows any base address to be configured but the hardware devices only support base addresses (configured by on-board DIP switches) from 0 or 0x200 (depending on the model) to 0x3F0 on 16-byte boundaries. Store the minimum supported I/O base addresses in the static board information array elements and add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/pcl812.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/pcl812.c b/drivers/comedi/drivers/pcl81= 2.c index abca61a72cf7..98b75792c09b 100644 --- a/drivers/comedi/drivers/pcl812.c +++ b/drivers/comedi/drivers/pcl812.c @@ -331,6 +331,7 @@ enum pcl812_boardtype { struct pcl812_board { const char *name; enum pcl812_boardtype board_type; + unsigned short min_io_start; int n_aichan; int n_aochan; unsigned int ai_ns_min; @@ -346,6 +347,7 @@ static const struct pcl812_board boardtypes[] =3D { { .name =3D "pcl812", .board_type =3D BOARD_PCL812, + .min_io_start =3D 0, .n_aichan =3D 16, .n_aochan =3D 2, .ai_ns_min =3D 33000, @@ -355,6 +357,7 @@ static const struct pcl812_board boardtypes[] =3D { .has_dio =3D 1, }, { .name =3D "pcl812pg", + .min_io_start =3D 0, .board_type =3D BOARD_PCL812PG, .n_aichan =3D 16, .n_aochan =3D 2, @@ -366,6 +369,7 @@ static const struct pcl812_board boardtypes[] =3D { }, { .name =3D "acl8112pg", .board_type =3D BOARD_PCL812PG, + .min_io_start =3D 0x200, .n_aichan =3D 16, .n_aochan =3D 2, .ai_ns_min =3D 10000, @@ -376,6 +380,7 @@ static const struct pcl812_board boardtypes[] =3D { }, { .name =3D "acl8112dg", .board_type =3D BOARD_ACL8112, + .min_io_start =3D 0x200, .n_aichan =3D 16, /* 8 differential */ .n_aochan =3D 2, .ai_ns_min =3D 10000, @@ -387,6 +392,7 @@ static const struct pcl812_board boardtypes[] =3D { }, { .name =3D "acl8112hg", .board_type =3D BOARD_ACL8112, + .min_io_start =3D 0x200, .n_aichan =3D 16, /* 8 differential */ .n_aochan =3D 2, .ai_ns_min =3D 10000, @@ -398,6 +404,7 @@ static const struct pcl812_board boardtypes[] =3D { }, { .name =3D "a821pgl", .board_type =3D BOARD_A821, + .min_io_start =3D 0, .n_aichan =3D 16, /* 8 differential */ .n_aochan =3D 1, .ai_ns_min =3D 10000, @@ -407,6 +414,7 @@ static const struct pcl812_board boardtypes[] =3D { }, { .name =3D "a821pglnda", .board_type =3D BOARD_A821, + .min_io_start =3D 0, .n_aichan =3D 16, /* 8 differential */ .ai_ns_min =3D 10000, .rangelist_ai =3D &range_pcl813b_ai, @@ -414,6 +422,7 @@ static const struct pcl812_board boardtypes[] =3D { }, { .name =3D "a821pgh", .board_type =3D BOARD_A821, + .min_io_start =3D 0, .n_aichan =3D 16, /* 8 differential */ .n_aochan =3D 1, .ai_ns_min =3D 10000, @@ -423,6 +432,7 @@ static const struct pcl812_board boardtypes[] =3D { }, { .name =3D "a822pgl", .board_type =3D BOARD_ACL8112, + .min_io_start =3D 0, .n_aichan =3D 16, /* 8 differential */ .n_aochan =3D 2, .ai_ns_min =3D 10000, @@ -433,6 +443,7 @@ static const struct pcl812_board boardtypes[] =3D { }, { .name =3D "a822pgh", .board_type =3D BOARD_ACL8112, + .min_io_start =3D 0, .n_aichan =3D 16, /* 8 differential */ .n_aochan =3D 2, .ai_ns_min =3D 10000, @@ -443,6 +454,7 @@ static const struct pcl812_board boardtypes[] =3D { }, { .name =3D "a823pgl", .board_type =3D BOARD_ACL8112, + .min_io_start =3D 0, .n_aichan =3D 16, /* 8 differential */ .n_aochan =3D 2, .ai_ns_min =3D 8000, @@ -453,6 +465,7 @@ static const struct pcl812_board boardtypes[] =3D { }, { .name =3D "a823pgh", .board_type =3D BOARD_ACL8112, + .min_io_start =3D 0, .n_aichan =3D 16, /* 8 differential */ .n_aochan =3D 2, .ai_ns_min =3D 8000, @@ -463,26 +476,31 @@ static const struct pcl812_board boardtypes[] =3D { }, { .name =3D "pcl813", .board_type =3D BOARD_PCL813, + .min_io_start =3D 0, .n_aichan =3D 32, .rangelist_ai =3D &range_pcl813b_ai, }, { .name =3D "pcl813b", .board_type =3D BOARD_PCL813B, + .min_io_start =3D 0, .n_aichan =3D 32, .rangelist_ai =3D &range_pcl813b_ai, }, { .name =3D "acl8113", .board_type =3D BOARD_ACL8113, + .min_io_start =3D 0x200, .n_aichan =3D 32, .rangelist_ai =3D &range_acl8113_1_ai, }, { .name =3D "iso813", .board_type =3D BOARD_ISO813, + .min_io_start =3D 0, .n_aichan =3D 32, .rangelist_ai =3D &range_iso813_1_ai, }, { .name =3D "acl8216", .board_type =3D BOARD_ACL8216, + .min_io_start =3D 0x200, .n_aichan =3D 16, /* 8 differential */ .n_aochan =3D 2, .ai_ns_min =3D 10000, @@ -495,6 +513,7 @@ static const struct pcl812_board boardtypes[] =3D { }, { .name =3D "a826pg", .board_type =3D BOARD_ACL8216, + .min_io_start =3D 0, .n_aichan =3D 16, /* 8 differential */ .n_aochan =3D 2, .ai_ns_min =3D 10000, @@ -1138,7 +1157,8 @@ static int pcl812_attach(struct comedi_device *dev, s= truct comedi_devconfig *it) if (!devpriv) return -ENOMEM; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x10); + ret =3D comedi_check_request_region(dev, it->options[0], 0x10, + board->min_io_start, 0x3ff, 16); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp87.ord1d.emailsrvr.com (smtp87.ord1d.emailsrvr.com [184.106.54.87]) (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 354D037F0E9 for ; Fri, 30 Jan 2026 17:05:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.87 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792713; cv=none; b=ocstk7OFl3GnlS3+zDBkQcRBPEcOR8/HpGAmRCGPIjyppRi29Q77gYV5Y2PXxvTS2kWkZdDmiD8AWTxb41Zpc0yynUyEU+Ots9Tz88WDQSW20QkdrA2v55SeI7ctnjTel/DjNRhwEon3TcZUAx4WiGZzUl7GPdCPTAvjiRT5FTs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792713; c=relaxed/simple; bh=hc7RTxKmK11XKSLcSwPcMWL6O8016J4NX46tAV2WK10=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n+zP5qc1VYSzTrvoiGedIurxqZTaqPzbzEv3TnbMIB0ukBY1S6OuJkC4aRls7djdeZvci3ifuvnrVFxDkcZoaF8VWryCEcZli/ptlEdp1hoiHgi4OGIpWuCUg3chHMfHmgES3sjM/4qPfUBDLL3e/uZs0CxAPmRczfa+7HympIM= 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=Js1e+8XT; arc=none smtp.client-ip=184.106.54.87 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="Js1e+8XT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792711; bh=hc7RTxKmK11XKSLcSwPcMWL6O8016J4NX46tAV2WK10=; h=From:To:Subject:Date:From; b=Js1e+8XTaEIXzdDzpkqu4HVVC6uMVsdfMHcg2VuCCSJKOK1lolmd0cEE7itfegK+w 22c34zCkdppXv0zShcOh+fRSl4o9QeZik34tJJfGFBsjS0xiK7aKjkB+FqzfqgkGeD g0Jc29f90J3qT39r3WczMf1aHjlg+bTfEhwkyFUE= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id E4840602F0; Fri, 30 Jan 2026 12:05:10 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 37/46] comedi: pcl816: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:48:02 +0000 Message-ID: <20260130170416.49994-38-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-38-1 Content-Type: text/plain; charset="utf-8" The "pcl816" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a PCL-816 or PCL-814B ISA board. It currently allows any base address to be configured but the hardware devices only support base addresses (configured by on-board DIP switches) from 0 to 0x3F0 on 16-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/pcl816.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/pcl816.c b/drivers/comedi/drivers/pcl81= 6.c index 28d1a88c50f6..1fcb2f798c7a 100644 --- a/drivers/comedi/drivers/pcl816.c +++ b/drivers/comedi/drivers/pcl816.c @@ -608,7 +608,8 @@ static int pcl816_attach(struct comedi_device *dev, str= uct comedi_devconfig *it) if (!devpriv) return -ENOMEM; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x10); + ret =3D comedi_check_request_region(dev, it->options[0], 0x10, + 0, 0x3ff, 16); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 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 23C1E3559F2 for ; Fri, 30 Jan 2026 17:05:13 +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=1769792714; cv=none; b=KANIjnW70UxZTDvw6GdN8D/Jnq0q5co6rQ4nFU25O/cOUSWsotKEeMIUXXZ/wez+mbY1J46YX/ZnRnDHeO+cxpaRZOvbyjUSOFAojMUWXU6rY0uugIc/Q0h2bQR8M1cLj3yGMrySiJwdmTChSw2ZsW7l7xxoEgHrjCHSHSlbxzk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792714; c=relaxed/simple; bh=YCPNPvm5mu8EbkoUOWeCYG1AEMvHwq2uygoIth/m21g=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Sh/RGW4Ka+mZKR7AEYKzAEyO67lB6tnLEmDRucE9e4JZoURFCt0Sy9BS2Bpdffjcy7DqexuyY/+0Xyxgh+vlBSzR3+VL2iLnus806WJn98mKBZYTB42c0jq3hTpaZLk9bQ3gv69lmeHfypkYlnXz6+CnDCeE6vXIbmvM5uVqamA= 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=P4p0HiJT; 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="P4p0HiJT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792712; bh=YCPNPvm5mu8EbkoUOWeCYG1AEMvHwq2uygoIth/m21g=; h=From:To:Subject:Date:From; b=P4p0HiJTNLo2OqD49nRlJA4oFblhgULIqGsOR26YczQLanMArbVxEzKIXWpgHfvOn Fj4u+XqzRHflplxZ48sfnsc6lV/EJsxGOAI/RZW7yAAeK7yfx1tg4PlIcXMVL4iJ9T 6EL3WjVztd8mPnD8xM+yilR6NviR+f2WDTIS9KIw= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id E7048602FB; Fri, 30 Jan 2026 12:05:11 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 38/46] comedi: pcl818: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:48:03 +0000 Message-ID: <20260130170416.49994-39-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-39-1 Content-Type: text/plain; charset="utf-8" The "pcl818" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a board in the PCL-818 series. It currently allows any base address to be configured but the hardware devices only support base addresses (configured by on-board DIP switches) from 0 to 0x3F0 on 16-byte boundaries. If the board has a FIFO and jumper JP6 is in the "Enabled" (default) position, then the base address needs to be on a 32-byte boundary and the length of the I/O port region will be 32 (to allow access to the FIFO registers) instead of 16. The state of jumper JP6 is unknown, so if the board has a FIFO device and is being configured on an odd 16-byte boundary, assume that jumper JP6 is in the "Disabled" position (to disallow access to the FIFO registers). Add a sanity check to ensure the device is not configured at an unsupported base address. If the board has a FIFO and is configured on an odd 16-byte boundary, log a reminder that JP6 needs to be in the "Disabled" position for correct operation. If the board has a FIFO and is configured on an even 16-byte boundary and the configuration option has been set to use the FIFO (`it->options[2] =3D=3D -1`), log a reminder that JP6 needs to be in the "Enabled" position. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/pcl818.c | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/drivers/comedi/drivers/pcl818.c b/drivers/comedi/drivers/pcl81= 8.c index 06fe06396f23..aa775a024fc7 100644 --- a/drivers/comedi/drivers/pcl818.c +++ b/drivers/comedi/drivers/pcl818.c @@ -981,6 +981,10 @@ static int pcl818_attach(struct comedi_device *dev, st= ruct comedi_devconfig *it) const struct pcl818_board *board =3D dev->board_ptr; struct pcl818_private *devpriv; struct comedi_subdevice *s; + unsigned int io_base =3D it->options[0]; + bool fifo_is_supported =3D board->has_fifo && !(io_base & 0x10); + bool fifo_is_wanted =3D board->has_fifo && it->options[2] =3D=3D -1; + unsigned int io_len =3D fifo_is_supported ? 0x20 : 0x10; unsigned int osc_base; int ret; =20 @@ -988,11 +992,28 @@ static int pcl818_attach(struct comedi_device *dev, s= truct comedi_devconfig *it) if (!devpriv) return -ENOMEM; =20 - ret =3D comedi_request_region(dev, it->options[0], - board->has_fifo ? 0x20 : 0x10); + ret =3D comedi_check_request_region(dev, io_base, io_len, + 0, 0x3ff, io_len); if (ret) return ret; =20 + if (board->has_fifo) { + /* let user know about any required JP6 setting */ + if (fifo_is_supported) { + if (fifo_is_wanted) { + dev_info(dev->class_dev, + "Assuming JP6 is in \"Enabled\" (default) position to use the FIFO.\= n"); + } + } else { + dev_info(dev->class_dev, + "JP6 needs to be in \"Disabled\" position for correct operation at th= is base address\n"); + if (fifo_is_wanted) { + dev_warn(dev->class_dev, + "FIFO cannot be used at this base address\n"); + } + } + } + /* we can use IRQ 2-7 for async command support */ if (it->options[1] >=3D 2 && it->options[1] <=3D 7) { ret =3D request_irq(it->options[1], pcl818_interrupt, 0, @@ -1002,7 +1023,7 @@ static int pcl818_attach(struct comedi_device *dev, s= truct comedi_devconfig *it) } =20 /* should we use the FIFO? */ - if (dev->irq && board->has_fifo && it->options[2] =3D=3D -1) + if (dev->irq && fifo_is_supported && fifo_is_wanted) devpriv->usefifo =3D 1; =20 /* we need an IRQ to do DMA on channel 3 or 1 */ --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp83.ord1d.emailsrvr.com (smtp83.ord1d.emailsrvr.com [184.106.54.83]) (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 74304381700 for ; Fri, 30 Jan 2026 17:05:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.83 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792715; cv=none; b=Y7bGI1kqTZBPDchxONkxx9HRI9areAuQvOA4ly5gPDao9XPrDQ8dhay800I39qh0z047M+okT8T1qj0xCX8FevqaAY7sel4/AWSlLMJxtaalC21+Wa9TvnJCnAy1WV6Ofm9BfgiLzNS/SZ/DzED5TihjN3ulagE4hNserayxfok= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792715; c=relaxed/simple; bh=BHtRYKvym9dsjgXQXfGX6rAx8v4hl85H3VwBS1f6qgg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KvTkw3FAgQRKHIbKRgR/CXu4Xjkqoo3uv8dbaewN5nlEbWwllEh26SOYcaMLnjMcdm8FoU+kiMVbtJiD4eaZFEDOxWddWfgF3Tj+gP7a/4tPLGmzt72qJkYRYFYSd9hX88fduLA6M08cTKJkmawoKcm47Dh/DfPn7avJ61nTrKQ= 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=TAVQJuxi; arc=none smtp.client-ip=184.106.54.83 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="TAVQJuxi" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792713; bh=BHtRYKvym9dsjgXQXfGX6rAx8v4hl85H3VwBS1f6qgg=; h=From:To:Subject:Date:From; b=TAVQJuxiAux19mW8kczxW8sxwW6p7i6VgCbcgbBqfNh6PnuVtqOM7xL//6Lmf+4CP 8/HTkT5CujWXESjODYQ7nkm1u5hcb7IOW4SL5hAlWBUMdmmsxTYallNBPchbZHkPiJ nf+dJAa8GOC6SB7QQfGJbYPildjEwahT4x8zpaFU= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id F1FE5601DE; Fri, 30 Jan 2026 12:05:12 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 39/46] comedi: pcm3724: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:48:04 +0000 Message-ID: <20260130170416.49994-40-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-40-1 Content-Type: text/plain; charset="utf-8" The "pcm3724" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a PCM-3724 board. It currently allows any base address to be configured but the hardware only supports base addresses (configured by on-board DIP switches) in the range 0 to 0x3F0 on 16-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/pcm3724.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/pcm3724.c b/drivers/comedi/drivers/pcm3= 724.c index fb41de3baef8..867bb5b3860a 100644 --- a/drivers/comedi/drivers/pcm3724.c +++ b/drivers/comedi/drivers/pcm3724.c @@ -194,7 +194,8 @@ static int pcm3724_attach(struct comedi_device *dev, if (!priv) return -ENOMEM; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x10); + ret =3D comedi_check_request_region(dev, it->options[0], 0x10, + 0, 0x3ff, 16); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp87.ord1d.emailsrvr.com (smtp87.ord1d.emailsrvr.com [184.106.54.87]) (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 5BFB338553A for ; Fri, 30 Jan 2026 17:05:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.87 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792716; cv=none; b=SPhGfKAvFuyaawU3zSgES8pHwuYNT6obZ+ez3IfwPF/Lo6LqE3U6mYX5zBEZ/DqEAEY3unH0UIbkPAZ4YxTVG+JhwqpVzfDaGnq0NRogHqdBFuJNr4jTkF11rt8xaO7zc8svRJUd2LKfQyBpeLlASByp8m6c8KuKD4xd0DsI2B8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792716; c=relaxed/simple; bh=jB+ajCqgfVksmcnaVupswMOIMZgZSMp+yjfqojBXKgA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=du5J3bOmvF+owUPhufBsesqk/NTgBsUweTuXis6W3GDT6AwgKvk39+EWMkJzEueoDN6HEhsg/Si5t/Fy3ZNaAOUE9JoXSk9eWsZBlE1xJmvju6NUrngN4zqTdy4ByTS0i7YrNqh1vIJHhuA648B1sBxxEifbYchgZy4A5UdwynM= 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=lz77N8j8; arc=none smtp.client-ip=184.106.54.87 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="lz77N8j8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792714; bh=jB+ajCqgfVksmcnaVupswMOIMZgZSMp+yjfqojBXKgA=; h=From:To:Subject:Date:From; b=lz77N8j8nAS+z+n4y+CNR1VL3Sk/Xz6ceeTYfNdmINDWMUvnAiTRcwYn2HwviB56C x5ZDFjQ9lVnEcxr4wVdDZagAiU6TwK4qPv/uhTYBfx8yYWmJMyLfZZPqjlsU3WHIfi BzQWkkJ19xdA/k4dyeYAEJK/DlIuNt5A0sBP19Mo= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 01DA9602BD; Fri, 30 Jan 2026 12:05:13 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 40/46] comedi: pcmad: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:48:05 +0000 Message-ID: <20260130170416.49994-41-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-41-1 Content-Type: text/plain; charset="utf-8" The "pcmad" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a PCM-A/D-12 or PCM-A/D-16 board. 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 0x3FC on 4-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/pcmad.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/pcmad.c b/drivers/comedi/drivers/pcmad.c index 976eda43881b..fd26b1eed1db 100644 --- a/drivers/comedi/drivers/pcmad.c +++ b/drivers/comedi/drivers/pcmad.c @@ -106,7 +106,8 @@ static int pcmad_attach(struct comedi_device *dev, stru= ct comedi_devconfig *it) struct comedi_subdevice *s; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x04); + ret =3D comedi_check_request_region(dev, it->options[0], 0x04, + 0, 0x3ff, 4); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp86.ord1d.emailsrvr.com (smtp86.ord1d.emailsrvr.com [184.106.54.86]) (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 5A91A361DA0 for ; Fri, 30 Jan 2026 17:05:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.86 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792717; cv=none; b=gMA9z25P/ArdblmELGBdpN6TBoMBqqm8Bp8BSwQSqauGrk7SevD4XyEYdXE1E4o4JUV27a65bZLpXfqs0mPF0Wu4NP4nWfzgD1GyNIpSdzAlLvoUmq2Eylzb48Yxnwm8RV2fOrdXPuaxc+QPo7EwTBIC//fsQfAW7zCEaWEHNUU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792717; c=relaxed/simple; bh=mzXTpWq6Q3L+Cujvk0gwBzE7s4jVHrT2pNUP4d35xnI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=StWPxq9GO9cmMbGTwtXWgnyVOx5OucXbcklsvHTpRiHMzW3Z9xb/DH5lg8gz1z7TRUEWtgF59XmGzXckxHV/0DlSDh0aUL/0mmMKKAmLBh0br6gOnW2IvXQF8TcxW8bftxKBKUxExGs/8fJkLmVTd+0YmI1VujnjuIXGs4dRjqI= 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=UgCqAsDG; arc=none smtp.client-ip=184.106.54.86 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="UgCqAsDG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792715; bh=mzXTpWq6Q3L+Cujvk0gwBzE7s4jVHrT2pNUP4d35xnI=; h=From:To:Subject:Date:From; b=UgCqAsDGPSfqVVvB4HvXRZeTwJtBMUyLeozjjIpD6+WovQdI0+hAys14IvjQLdG8p uSj5Rn1PsAgofG7IVsYhyDC4kiX+QXvstEuWF7IaUgnTFdaoQtFIOOop8foAK5MnY4 vS0DEa3WVc/jNhF6VThh6MMCDjqyi8DbUGqwZe6A= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 06EA6602A3; Fri, 30 Jan 2026 12:05:14 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 41/46] comedi: pcmda12: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:48:06 +0000 Message-ID: <20260130170416.49994-42-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-42-1 Content-Type: text/plain; charset="utf-8" The "pcmda12" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a PCM-D/A-12 or PCM-A/D-16 board. It currently allows any base address to be configured. I cannot find a full manual, but the short datasheet says it uses 15 consecutive I/O addresses on "any even sixteen port boundary", so assume it supports base addresses (configured by on-board jumpers) in the range 0 to 0x3E0 on 32-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/pcmda12.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/pcmda12.c b/drivers/comedi/drivers/pcmd= a12.c index 611f13bedca0..6efd1ae6271a 100644 --- a/drivers/comedi/drivers/pcmda12.c +++ b/drivers/comedi/drivers/pcmda12.c @@ -120,7 +120,14 @@ static int pcmda12_attach(struct comedi_device *dev, struct comedi_subdevice *s; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x10); + /* + * The datasheet says it requires 16 contiguous addresses and is + * "configurable on any even sixteen port boundary". So require + * a 32-byte boundary and assume it uses 10-bit addresses like + * similar boards. + */ + ret =3D comedi_check_request_region(dev, it->options[0], 0x10, + 0, 0x3ff, 32); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp82.ord1d.emailsrvr.com (smtp82.ord1d.emailsrvr.com [184.106.54.82]) (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 629B6387344 for ; Fri, 30 Jan 2026 17:05:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.82 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792718; cv=none; b=PpwVK3XHlKDzg/0TGaqHugCx+mEJX0QTIj9xcShdth5lYhhougRdqLVSeKXrEeE6ZzeJfV41Rh9KHKMDUYBpLPeytt3VVb2oIwGLZcQxG2FqMthRJqG9n5ZmlldVRJAym3dXeFJpEqM7NRkI3PR+8CN5q/W+JkcLCB3NOy5EN3k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792718; c=relaxed/simple; bh=cdikeM5G6zKz4vSECkwd3maYKjw7IEEUUM+25PzmvAU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ecP2x4i63TzBCQ7XD/Z9vTxhbMIjgqf0HToG89loCBWSG3nnTCCH1r3maWxMmJJvYjPym/EwNYU09dCN+Eae8fIY9dpM/Xf1Vmuvh7Poh2FJzXSAZDNUpUVzANfckD+IAD/QZZtX3BIafGsK3QcYOGvKziWQ0taj7LwM+BtaqRE= 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=u/gTf0nc; arc=none smtp.client-ip=184.106.54.82 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="u/gTf0nc" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792716; bh=cdikeM5G6zKz4vSECkwd3maYKjw7IEEUUM+25PzmvAU=; h=From:To:Subject:Date:From; b=u/gTf0ncS5ZN5BE+m8Kp3wUSTP+rnYN6rDhzR7aoqoJtDIgmqVhL8aQvsfJ2Ri+a7 QDEFyiyu63aiEkLs2mjXP1imynZBAcf65BMMP0bBRNXXarC8R574XAqxY6A0Xwea+m BWwWp6ApTkrbsbKItAbBxffcFFbjx27ZD3+XIelA= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 0BD97601DE; Fri, 30 Jan 2026 12:05:15 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 42/46] comedi: pcmmio: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:48:07 +0000 Message-ID: <20260130170416.49994-43-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-43-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-MIO board. 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 0xFFE0 on 32-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/pcmmio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/pcmmio.c b/drivers/comedi/drivers/pcmmi= o.c index c2402239d551..d38202c8a12b 100644 --- a/drivers/comedi/drivers/pcmmio.c +++ b/drivers/comedi/drivers/pcmmio.c @@ -667,7 +667,8 @@ static int pcmmio_attach(struct comedi_device *dev, str= uct comedi_devconfig *it) struct comedi_subdevice *s; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 32); + ret =3D comedi_check_request_region(dev, it->options[0], 32, + 0, 0xffff, 32); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 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 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp86.ord1d.emailsrvr.com (smtp86.ord1d.emailsrvr.com [184.106.54.86]) (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 4D199387563 for ; Fri, 30 Jan 2026 17:05:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.86 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792720; cv=none; b=aiWXYaLJuTwTMoExnQ9la4vQOlJm1bHghw0lybrayLFNKSJGImU2nbw+3Zh8AmYlCghWKzUT0k3wOBNog0jf/xu0dr1nKdkyRmb1JOMKCAzd4PVUMa3ibU2qY8ZNkTpuToz/Amy0zUg9vSAv1lm5PHpXR5y+J8qP9GlgGbpBckw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792720; c=relaxed/simple; bh=GDdg7RCvxWuARJkYdHopc1UvAFkwWp3JbHbW2B8QB38=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rzkqO9v76GzKH3n9w1KJN0r7pnqd6aV+nLVPbuWfyL4JTkZypsXvvlO4vTAvH2LjPh3raLL1Bo4sZAYpjadFQYKmvl5b2KqMgy+hTBzuEG+UJyrsNolfPB8UjbXb3PbvfzGNcRAw3DnMTb/Xn6sVfFwZ7c44VV9AMYCxPhs+VSE= 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=bcewaUyB; arc=none smtp.client-ip=184.106.54.86 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="bcewaUyB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792718; bh=GDdg7RCvxWuARJkYdHopc1UvAFkwWp3JbHbW2B8QB38=; h=From:To:Subject:Date:From; b=bcewaUyBMutDU54sNJf4x9hgaFMZAzh3JDnDFBEaeVfDpIEB39MK799oo6D4rqy2S xG0RE+yqhIKB7QoOGkaWPPAm16SMWI2LWSFl1wGHwmZqWufx8soY17R7FsC4gxOW36 cxhx8YUm9dR8BOoVSxV/vkTtKnjqoeLNqTU2mK2I= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 20EA6602A3; Fri, 30 Jan 2026 12:05:18 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 44/46] comedi: rti800: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:48:09 +0000 Message-ID: <20260130170416.49994-45-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-45-1 Content-Type: text/plain; charset="utf-8" The "rti800" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a RTI-800 or RTI-815 board. It currently allows any base address to be configured but the hardware only supports base addresses (configured by on-board DIP switches) in the range 0 to 0x3F0 on 16-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/rti800.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/rti800.c b/drivers/comedi/drivers/rti80= 0.c index 1b02e47bdb4c..fa3965cf92f2 100644 --- a/drivers/comedi/drivers/rti800.c +++ b/drivers/comedi/drivers/rti800.c @@ -257,7 +257,8 @@ static int rti800_attach(struct comedi_device *dev, str= uct comedi_devconfig *it) struct comedi_subdevice *s; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x10); + ret =3D comedi_check_request_region(dev, it->options[0], 0x10, + 0, 0x3ff, 16); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp86.ord1d.emailsrvr.com (smtp86.ord1d.emailsrvr.com [184.106.54.86]) (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 89652387595 for ; Fri, 30 Jan 2026 17:05:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.86 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792721; cv=none; b=CYaaQKpKawKZZH2nPwTGKqTh6RnDKKKSwUD8MrIeAn8sibHdem7x8O0z3AuLY19qbWQmrUeM8yaiQxuQQGoahsRFQQNsAweqpRKC/JgHoitQpIXBVzYJlT+bop+NonU6m/F/hdGUoOew2xTSyaVQVpaLO+Eh8geKogbjY5jcpUE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792721; c=relaxed/simple; bh=3MfuapEpZxJXIYmrjIk/OUsHqV3wxoPXG2geAhawHEI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d8zHux33Ugjana5O4jaVvXU+EjGOQeEcYgRhJRUMUBETGVORH6gE1uUBJsuFpT3vhJtiTqCNg1umKo4bq39GW7HbaKjEL4bmhfjLSRXap6KK9T+P5Lu3IWtqJs8VC6Klu9LC4U/EN0bitQWhpIuj+AycowjiShN9Bi4GI94ac/o= 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=C+yXIit6; arc=none smtp.client-ip=184.106.54.86 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="C+yXIit6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792719; bh=3MfuapEpZxJXIYmrjIk/OUsHqV3wxoPXG2geAhawHEI=; h=From:To:Subject:Date:From; b=C+yXIit68c0Ns2cBrS6q/2IfdZPbwSty1N9e4bkIhue8fUvmecwzqTQDd4HxZyDHX St4sQz7zS8qfR0niu24BjLikfZP44Fa09OW8CI/DPpGA+UDFC++AawYc6Ytd40YyeF KqqCUgsS6iDv2DcBcmIKAOsqQja8s2p5qpBeDnGo= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 266E9601DE; Fri, 30 Jan 2026 12:05:19 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 45/46] comedi: rti802: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:48:10 +0000 Message-ID: <20260130170416.49994-46-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-46-1 Content-Type: text/plain; charset="utf-8" The "rti800" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a RTI-802 board. It currently allows any base address to be configured but the hardware only supports base addresses (configured by on-board DIP switches) in the range 0 to 0x3FC on 4-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/rti802.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/rti802.c b/drivers/comedi/drivers/rti80= 2.c index d66762a22258..af990881c27a 100644 --- a/drivers/comedi/drivers/rti802.c +++ b/drivers/comedi/drivers/rti802.c @@ -72,7 +72,8 @@ static int rti802_attach(struct comedi_device *dev, struc= t comedi_devconfig *it) int i; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x04); + ret =3D comedi_check_request_region(dev, it->options[0], 0x04, + 0, 0x3ff, 4); if (ret) return ret; =20 --=20 2.51.0 From nobody Sun Feb 8 13:45:03 2026 Received: from smtp84.ord1d.emailsrvr.com (smtp84.ord1d.emailsrvr.com [184.106.54.84]) (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 763E2387344 for ; Fri, 30 Jan 2026 17:05:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.84 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792722; cv=none; b=tYRLkwkEng4dMVFssyjao4RWPgdDlLxY1RzdGqFCT3ds8X1i3WYJD80GT8miM+bmNxZD9V5YgBZ1gNKXFCbAwY503NvVHdskTCeN6jA0tNgRUnjJ3GLA4b6XM5io+2atmZEfkdji09Bq31ESS8kxdh+i4vjUV3V7VqdGkiZOc94= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792722; c=relaxed/simple; bh=b+02Z7RR60i8vuOwiPfoY7md+K3xR7uYMw9zWtcWCLg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AlVxAJ0vQ2rVFYYS5uYerv0iPmWjEFq9HGv2itbxWLG3Oyev59yfZbsSJKHP4Y+6BPjgrmb86VRUzMPBuHRvWxecmBsTivK+LdRgYkj2IPKME4q9VBsctYf627sVES3IVJBbj3BC+pSB2S1AFKXnHrSaGGbLhsEhVeZcrQmeiA4= 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=j0cjAXMW; arc=none smtp.client-ip=184.106.54.84 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="j0cjAXMW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792720; bh=b+02Z7RR60i8vuOwiPfoY7md+K3xR7uYMw9zWtcWCLg=; h=From:To:Subject:Date:From; b=j0cjAXMW6hywgAElIdL8VVqk5JhvKYFumfbLjRvzQZnyiQarzIj9R2rjnMx1IIjiq tbZG0JJvr98IS3GA5MXNs4zqxcuc1DpVD2b+FGr/vUP4wQ42hS6t1T9HJlIAiNgQjG 23RaG+aKGTCIHe5I+uaGW8W3VH9lS1lwIM5nZFfs= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 29CDE602BD; Fri, 30 Jan 2026 12:05:20 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 46/46] comedi: s526: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:48:11 +0000 Message-ID: <20260130170416.49994-47-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-47-1 Content-Type: text/plain; charset="utf-8" The "s526" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a Sensoray 526 board. It currently allows any base address to be configured but the hardware only supports base addresses (configured by on-board DIP switches) in the range 0 to 0xFFC0 on 64-byte boundaries. Add a sanity check to ensure the device is not configured at an unsupported base address. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/s526.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/s526.c b/drivers/comedi/drivers/s526.c index 9245c679a3c4..dd27c754dea4 100644 --- a/drivers/comedi/drivers/s526.c +++ b/drivers/comedi/drivers/s526.c @@ -553,7 +553,8 @@ static int s526_attach(struct comedi_device *dev, struc= t comedi_devconfig *it) struct comedi_subdevice *s; int ret; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x40); + ret =3D comedi_check_request_region(dev, it->options[0], 0x40, + 0, 0xffc0, 64); if (ret) return ret; =20 --=20 2.51.0