public inbox for linux-raid@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: Song Liu <song@kernel.org>
Cc: linux-raid@vger.kernel.org
Subject: [bug report] md: Remove deprecated CONFIG_MD_MULTIPATH
Date: Mon, 15 Dec 2025 10:58:17 +0300	[thread overview]
Message-ID: <aT-_mc1MEKdpqkdZ@stanley.mountain> (raw)

Hello Song Liu,

Commit d8730f0cf4ef ("md: Remove deprecated CONFIG_MD_MULTIPATH")
from Dec 14, 2023 (linux-next), leads to the following Smatch static
checker warning:

	drivers/md/md.c:3912 analyze_sbs()
	warn: iterator 'i' not incremented

drivers/md/md.c
    3883 static int analyze_sbs(struct mddev *mddev)
    3884 {
    3885         int i;
    3886         struct md_rdev *rdev, *freshest, *tmp;
    3887 
    3888         freshest = NULL;
    3889         rdev_for_each_safe(rdev, tmp, mddev)
    3890                 switch (super_types[mddev->major_version].
    3891                         load_super(rdev, freshest, mddev->minor_version)) {
    3892                 case 1:
    3893                         freshest = rdev;
    3894                         break;
    3895                 case 0:
    3896                         break;
    3897                 default:
    3898                         pr_warn("md: fatal superblock inconsistency in %pg -- removing from array\n",
    3899                                 rdev->bdev);
    3900                         md_kick_rdev_from_array(rdev);
    3901                 }
    3902 
    3903         /* Cannot find a valid fresh disk */
    3904         if (!freshest) {
    3905                 pr_warn("md: cannot find a valid disk\n");
    3906                 return -EINVAL;
    3907         }
    3908 
    3909         super_types[mddev->major_version].
    3910                 validate_super(mddev, NULL/*freshest*/, freshest);
    3911 
--> 3912         i = 0;
    3913         rdev_for_each_safe(rdev, tmp, mddev) {
    3914                 if (mddev->max_disks &&
    3915                     (rdev->desc_nr >= mddev->max_disks ||
    3916                      i > mddev->max_disks)) {
                              ^^^^^^^^^^^^^^^^^^^^
The patch deleted the i++ so i is always zero.

    3917                         pr_warn("md: %s: %pg: only %d devices permitted\n",
    3918                                 mdname(mddev), rdev->bdev,
    3919                                 mddev->max_disks);
    3920                         md_kick_rdev_from_array(rdev);
    3921                         continue;
    3922                 }
    3923                 if (rdev != freshest) {
    3924                         if (super_types[mddev->major_version].
    3925                             validate_super(mddev, freshest, rdev)) {
    3926                                 pr_warn("md: kicking non-fresh %pg from array!\n",
    3927                                         rdev->bdev);
    3928                                 md_kick_rdev_from_array(rdev);
    3929                                 continue;
    3930                         }
    3931                 }
    3932                 if (rdev->raid_disk >= (mddev->raid_disks - min(0, mddev->delta_disks)) &&
    3933                     !test_bit(Journal, &rdev->flags)) {
    3934                         rdev->raid_disk = -1;
    3935                         clear_bit(In_sync, &rdev->flags);
    3936                 }
    3937         }
    3938 
    3939         return 0;
    3940 }

regards,
dan carpenter

             reply	other threads:[~2025-12-15  7:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-15  7:58 Dan Carpenter [this message]
2025-12-15 12:40 ` [bug report] md: Remove deprecated CONFIG_MD_MULTIPATH Li Nan
  -- strict thread matches above, loose matches on Subject: below --
2024-05-04 11:23 Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aT-_mc1MEKdpqkdZ@stanley.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=song@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox