From nobody Tue Feb 10 05:44:08 2026 Received: from smtp82.ord1d.emailsrvr.com (smtp82.ord1d.emailsrvr.com [184.106.54.82]) (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 99755357716 for ; Fri, 30 Jan 2026 17:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.82 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792689; cv=none; b=reRa2lTGLKy78htsH1ErgLUfhWtg9d7t7IX/gfQSvXelM/Z5jkD6fotssXrcCD4QF+APlPgU79A+RHnT5xbwtVWt3Ed+A7CsBxZD0WrrBsavf0ixdBeDUH/f+AsTDb2NJbxqQppmP2w4w6YtM6fOSPJVwg8RYiLYpT5+c9upzRw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792689; c=relaxed/simple; bh=56R6TJ37IxH77Nh4vrOS6uvnAjRcma3p97Or+x9ibj0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X2VCLnlOJkUrZbZH1EzPoxv0QW87FOMoWbkt3gVQQHvBdMJqeF8qg0AKcdDO5PlseYQBfQYqqVtFPQ8c3/tJv4oUkAHddT7icoMf9QS5yH0oFCt8pCc/2YOoZJKzUKqZ+SiJH2Z8rXmB5KkhzmD2+VyNh+9zIUrVz5aiisLlGZ0= 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=y0RzNd1O; arc=none smtp.client-ip=184.106.54.82 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="y0RzNd1O" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792686; bh=56R6TJ37IxH77Nh4vrOS6uvnAjRcma3p97Or+x9ibj0=; h=From:To:Subject:Date:From; b=y0RzNd1O6qe6+kgnqQY2YJM0jYijRma04OI/7itiF+JN5Uklwwo00rjG5pvd+t6SZ pOEq7815e3lCQ7H2W4YpRtLl5DJY2Ci/Xee8rzeDxTJ9gKFbC+ORMsLy8WOXohQJXj WQmF+QAYViuGOXWbQFvXJdCuJox/iNYE3wgTsOdA= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id AB47160306; Fri, 30 Jan 2026 12:04:45 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 15/46] comedi: das1800: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:40 +0000 Message-ID: <20260130170416.49994-16-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-16-1 Content-Type: text/plain; charset="utf-8" The "das1800" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a board compatible with the DAS1800 series. It currently allows any base address to be configured but the hardware only supports base addresses (configured by an on-board DIP switch) in the range 0 to 0x3f0 on 16-byte boundaries. Some boards have an additional span of up to 0x10 registers at offset 0x400 from the main 0x10 byte region. Add a sanity check to ensure the device is not configured at an unsupported base address. If the main base address is correctly aligned and within range, then the additional region at offset 0x400 from the configured base address will naturally be within range and correctly aligned. Signed-off-by: Ian Abbott --- drivers/comedi/drivers/das1800.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/das1800.c b/drivers/comedi/drivers/das1= 800.c index 7117c67aee7e..7d7ea99a81aa 100644 --- a/drivers/comedi/drivers/das1800.c +++ b/drivers/comedi/drivers/das1800.c @@ -1172,7 +1172,8 @@ static int das1800_attach(struct comedi_device *dev, if (!devpriv) return -ENOMEM; =20 - ret =3D comedi_request_region(dev, it->options[0], DAS1800_SIZE); + ret =3D comedi_check_request_region(dev, it->options[0], DAS1800_SIZE, + 0, 0x3ff, 16); if (ret) return ret; =20 --=20 2.51.0