From nobody Mon Feb 9 19:05:11 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