From nobody Tue Feb 10 04:14:17 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