From patchwork Sun Jul 24 18:33:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikulas Patocka X-Patchwork-Id: 12927618 X-Patchwork-Delegate: song@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32CC2C43334 for ; Sun, 24 Jul 2022 18:34:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232398AbiGXSd7 (ORCPT ); Sun, 24 Jul 2022 14:33:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229640AbiGXSd6 (ORCPT ); Sun, 24 Jul 2022 14:33:58 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 99E53DF98 for ; Sun, 24 Jul 2022 11:33:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1658687636; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=47qGMB50flDp847zXgte4NJA8AQcr6v9hI2Mi5YuAqw=; b=KPAHn+1Fq5pt/7DkJGYDbqoYRE15VhX+WwjiIujdWv5atfkOfam8VO7c8LLw1OQP5xjrYn mg+3hlTHbHHzxh6iF/5fidxbV7lhViv5KqDMG/S7DGqrCu6a0ISOCHdkuE2DYcOJYh8iMw iWjYuf0SOrq3IpCWF4fqecPVaci+Fnw= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-500-1ipN5vwjN8C_BCxyJPYTbA-1; Sun, 24 Jul 2022 14:33:53 -0400 X-MC-Unique: 1ipN5vwjN8C_BCxyJPYTbA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id EFBF71C05141; Sun, 24 Jul 2022 18:33:52 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E4A9E2026D64; Sun, 24 Jul 2022 18:33:52 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id 26OIXqIH026674; Sun, 24 Jul 2022 14:33:52 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id 26OIXqna026670; Sun, 24 Jul 2022 14:33:52 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Sun, 24 Jul 2022 14:33:52 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Mike Snitzer , Heinz Mauelshagen cc: Song Liu , linux-raid@vger.kernel.org, dm-devel@redhat.com Subject: [PATCH] dm-raid: fix address sanitizer warning in raid_resume Message-ID: User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org 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 Cc: stable@vger.kernel.org --- drivers/md/dm-raid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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))