aboutsummaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org> 2024-05-23 13:38:31 -0700
committerGravatar Linus Torvalds <torvalds@linux-foundation.org> 2024-05-23 13:38:31 -0700
commit09f8f2c4ca4263b40f766238a92ef9c5f93ea5a5 (patch)
treebd46d785100ec24dce8ea480a97caf93e5a0766b /drivers/base
parentMerge tag 'net-6.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/net... (diff)
parentregmap: kunit: Fix array overflow in stride() test (diff)
downloadlinux-09f8f2c4ca4263b40f766238a92ef9c5f93ea5a5.tar.gz
linux-09f8f2c4ca4263b40f766238a92ef9c5f93ea5a5.tar.bz2
linux-09f8f2c4ca4263b40f766238a92ef9c5f93ea5a5.zip
Merge tag 'regmap-fix-v6.10-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap
Pull regmap fix from Mark Brown: "Guenter ran with memory sanitisers and found an issue in the new KUnit tests that Richard added where an assumption in older test code was exposed, this was fixed quickly by Richard" * tag 'regmap-fix-v6.10-merge-window' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap: regmap: kunit: Fix array overflow in stride() test
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/regmap/regmap-kunit.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/base/regmap/regmap-kunit.c b/drivers/base/regmap/regmap-kunit.c
index 9c5314785fc2..be32cd4e84da 100644
--- a/drivers/base/regmap/regmap-kunit.c
+++ b/drivers/base/regmap/regmap-kunit.c
@@ -609,12 +609,19 @@ static void stride(struct kunit *test)
config.reg_stride = 2;
config.num_reg_defaults = BLOCK_TEST_SIZE / 2;
+ /*
+ * Allow one extra register so that the read/written arrays
+ * are sized big enough to include an entry for the odd
+ * address past the final reg_default register.
+ */
+ config.max_register = BLOCK_TEST_SIZE;
+
map = gen_regmap(test, &config, &data);
KUNIT_ASSERT_FALSE(test, IS_ERR(map));
if (IS_ERR(map))
return;
- /* Only even registers can be accessed, try both read and write */
+ /* Only even addresses can be accessed, try both read and write */
for (i = 0; i < BLOCK_TEST_SIZE; i++) {
data->read[i] = false;
data->written[i] = false;