From nobody Tue Feb 10 05:44:05 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