[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20220328075628.25545-1-xiam0nd.tong@gmail.com>
Date: Mon, 28 Mar 2022 15:56:28 +0800
From: Xiaomeng Tong <xiam0nd.tong@...il.com>
To: guoqing.jiang@...ux.dev
Cc: linux-kernel@...r.kernel.org, linux-raid@...r.kernel.org,
rgoldwyn@...e.com, song@...nel.org, stable@...r.kernel.org,
xiam0nd.tong@...il.com
Subject: Re: [PATCH] md: md2: fix an incorrect NULL check on list iterator
> I'd suggest to rephrase the subject to "md: fix an incorrect NULL check
> in md_reload_sb".
Thank you for the suggestion, i will take it in PATCH v2.
> > - if (!rdev || rdev->desc_nr != nr) {
> > + if (!rdev) {
> > pr_warn("%s: %d Could not find rdev with nr %d\n", __func__, __LINE__, nr);
> > return;
> > }
>
> I guess we only need to check desc_nr since rdev should always be valid
> , and IMO the fix tag
> is not necessary.
No. At least from the pr_warn log, the list can be empty or no element found in it.
If this cases happen, the 'rdev' will be an invalid pointer that point to a invalid
struct containning the HEAD '&((mddev)->disks)'. So this fix is necessary.
--
Xiaomeng Tong
Powered by blists - more mailing lists