diff mbox series

dm-raid: fix address sanitizer warning in raid_resume

Message ID alpine.LRH.2.02.2207241431590.26078@file01.intranet.prod.int.rdu2.redhat.com (mailing list archive)
State New, archived
Delegated to: Song Liu
Headers show
Series dm-raid: fix address sanitizer warning in raid_resume | expand

Commit Message

Mikulas Patocka July 24, 2022, 6:33 p.m. UTC
There is a KASAN warning in raid_resume when running the lvm test
lvconvert-raid.sh. The reason for the warning is that mddev->raid_disks is
greater than rs->raid_disks, so the loop touches one entry beyond the
allocated length.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org

---
 drivers/md/dm-raid.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

Index: linux-2.6/drivers/md/dm-raid.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-raid.c	2022-07-23 15:22:37.000000000 +0200
+++ linux-2.6/drivers/md/dm-raid.c	2022-07-23 15:23:09.000000000 +0200
@@ -3819,7 +3819,7 @@  static void attempt_restore_of_faulty_de
 
 	memset(cleared_failed_devices, 0, sizeof(cleared_failed_devices));
 
-	for (i = 0; i < mddev->raid_disks; i++) {
+	for (i = 0; i < rs->raid_disks; i++) {
 		r = &rs->dev[i].rdev;
 		/* HM FIXME: enhance journal device recovery processing */
 		if (test_bit(Journal, &r->flags))