From nobody Tue Feb 10 05:27:06 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 3B48037F101 for ; Fri, 30 Jan 2026 17:05:06 +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=1769792707; cv=none; b=rbYGJXQyF0z05LHlWnLdMGaqgA1KpCQg8ythmxMx2XDXVqbcSImLqd0nISoIv2dEMVx0xo65GQpQuD9FNXs9JpP7jAn1VQ4MqlYUEqYhC6qBvtL3o2ho5sjc9HFA/9fWVCUKoQVllj7WI6PlwZxb0Q489cqU9kCV3hhVRO9GX3w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792707; c=relaxed/simple; bh=6cMcencm5USbxlQ1Iu5b7Lv+bYDJXQLAK/l1PP5HXV8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=F+pkcmVDGR2mCy1vc0qfeKa5HBIgeQBW9IZFoVxHPQgCWpP1zakQeYo64OQJ4wsfRCbNsjZQJ24ShRCb3ey5IlFsAKYVai6/EitCr8vrHv1gHqdsgipb/hkQKf9F/S/W4/Hl7klyOEw8AFpSrQQT2FA56lppHxgnflrdfxjvzEA= 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=ZYw4z76l; 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="ZYw4z76l" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792705; bh=6cMcencm5USbxlQ1Iu5b7Lv+bYDJXQLAK/l1PP5HXV8=; h=From:To:Subject:Date:From; b=ZYw4z76lWtISI5af/4OogO9C+tkwrMTOK/J79cRmYA1iKcf3zmevOA++Sbn3F6hpc XaPh6VUSjTVGxr0Vpp38A3I0cTMQgvKpaZxcxdtjyqsW02ad+G2+7pQUizvy5appVv 140lbLZmnWS9dGDWbWkwJJyA3mz33q+kz543sHZo= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id BC397602FA; Fri, 30 Jan 2026 12:05:04 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 31/46] comedi: ni_labpc: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:56 +0000 Message-ID: <20260130170416.49994-32-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-32-1 Content-Type: text/plain; charset="utf-8" The "ni_labpc" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a Lab-PC-1200 series or Lab-PC+ board. It currently allows any base address to be configured but the hardware only supports base addresses (configured by a configuration utility and stored in nonvolatile memory) 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_labpc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/ni_labpc.c b/drivers/comedi/drivers/ni_= labpc.c index b25a8e117072..93b5333a99b5 100644 --- a/drivers/comedi/drivers/ni_labpc.c +++ b/drivers/comedi/drivers/ni_labpc.c @@ -78,7 +78,8 @@ static int labpc_attach(struct comedi_device *dev, struct= comedi_devconfig *it) unsigned int dma_chan =3D it->options[2]; 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