From nobody Mon Feb 9 19:38:06 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