From nobody Mon Feb 9 19:25:56 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