From nobody Mon Feb 9 19:05:25 2026 Received: from smtp87.ord1d.emailsrvr.com (smtp87.ord1d.emailsrvr.com [184.106.54.87]) (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 985973502B3 for ; Fri, 30 Jan 2026 17:04:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=184.106.54.87 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792690; cv=none; b=taI9ezLvR83BD38YCWNa7tSaQu6ktujHdxiPaQJWvipCZF5x0SjabNwI3lI6QiONeGAccvPjC1dyoCzJdcz5ZgnpNVnilKOhYuHMpB+SDaPULRGcdZXo1kke+MPN+ffbbqI3R5vUcOFYQqhnAY7ru0yhtyrSn+i3ntCPdaMB30o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769792690; c=relaxed/simple; bh=T+VEziWL4pC/DdTQ+CsMIfbW1uMy6EZlGyGaXgcaUGE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WeSlUIziVf5gpX4EdyYqdzni28WBbYEA34btz6ShOd/s2mY5UAQpm5DSPJXF9I7CCoHSEnGf+x1TmpzjlHvRe5VH4Vy2DuWBxthpNUbcl26VPv+hBAS72HcxWHuaN/jObkaDMaTT5ITfLttKd4TH9TRAoMLhZriaDbogOI1mSVA= 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=A5viHTCT; arc=none smtp.client-ip=184.106.54.87 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="A5viHTCT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20221208-6x11dpa4; t=1769792685; bh=T+VEziWL4pC/DdTQ+CsMIfbW1uMy6EZlGyGaXgcaUGE=; h=From:To:Subject:Date:From; b=A5viHTCTZ3fyF38U22Qxsaz0GQzkn7ng5InGubJWAV3lhDUKrVtagD/JuCJUAUMx/ whnbgQeEPht5NrqIvPF7cGyoLge7ML9d+6MqyjUBeXS4dlL7aiuuufLV1vxxYnw+Z3 ZEIZdDkk1etq10FIiCmjzXCi5DEjtzWh0BuHVkjE= X-Auth-ID: abbotti@mev.co.uk Received: by smtp19.relay.ord1d.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id A0FC660301; Fri, 30 Jan 2026 12:04:44 -0500 (EST) From: Ian Abbott To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Ian Abbott , H Hartley Sweeten Subject: [PATCH 14/46] comedi: das16m1: Add sanity checks for I/O base address Date: Fri, 30 Jan 2026 16:47:39 +0000 Message-ID: <20260130170416.49994-15-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-15-1 Content-Type: text/plain; charset="utf-8" The "das16m1" driver uses an admin-supplied configuration option (`it->options[0]`) to configure the I/O port base address of a DAS16/M1 board. 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. It has an additional span of 0x8 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/das16m1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/comedi/drivers/das16m1.c b/drivers/comedi/drivers/das1= 6m1.c index 1b638f5b5a4f..9f531ba593b4 100644 --- a/drivers/comedi/drivers/das16m1.c +++ b/drivers/comedi/drivers/das16m1.c @@ -511,7 +511,8 @@ static int das16m1_attach(struct comedi_device *dev, if (!devpriv) return -ENOMEM; =20 - ret =3D comedi_request_region(dev, it->options[0], 0x10); + ret =3D comedi_check_request_region(dev, it->options[0], 0x10, + 0, 0x3ff, 16); if (ret) return ret; /* Request an additional region for the 8255 and 3rd 8254 */ --=20 2.51.0