lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <5727ab54-6280-466e-b107-1b6006e5ab29@stanley.mountain>
Date: Fri, 9 Aug 2024 15:28:30 +0300
From: Dan Carpenter <dan.carpenter@...aro.org>
To: Kim Seer Paller <kimseer.paller@...log.com>
Cc: Michael Hennerich <michael.hennerich@...log.com>,
	Jonathan Cameron <jic23@...nel.org>,
	Lars-Peter Clausen <lars@...afoo.de>,
	Conor Dooley <conor.dooley@...rochip.com>,
	Nuno Sa <nuno.sa@...log.com>, linux-iio@...r.kernel.org,
	linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [PATCH] iio: dac: ltc2664: Fix off by one in ltc2664_channel_config()

This comparison should be >= ARRAY_SIZE() instead of >.  The "mspan"
variable is later used as an array index into ltc2664_mspan_lut[] so
this is an off by one bug.

Fixes: 4cc2fc445d2e ("iio: dac: ltc2664: Add driver for LTC2664 and LTC2672")
Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
---
 drivers/iio/dac/ltc2664.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/dac/ltc2664.c b/drivers/iio/dac/ltc2664.c
index 666ecdeb5f96..5be5345ac5c8 100644
--- a/drivers/iio/dac/ltc2664.c
+++ b/drivers/iio/dac/ltc2664.c
@@ -526,7 +526,7 @@ static int ltc2664_channel_config(struct ltc2664_state *st)
 			return dev_err_probe(dev, -EINVAL,
 			       "adi,manual-span-operation-config not supported\n");
 
-		if (mspan > ARRAY_SIZE(ltc2664_mspan_lut))
+		if (mspan >= ARRAY_SIZE(ltc2664_mspan_lut))
 			return dev_err_probe(dev, -EINVAL,
 			       "adi,manual-span-operation-config not in range\n");
 	}
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ