From: Xiaomeng Tong <xiam0nd.tong@gmail.com>
To: guoqing.jiang@linux.dev
Cc: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org,
rgoldwyn@suse.com, song@kernel.org, stable@vger.kernel.org,
xiam0nd.tong@gmail.com
Subject: Re: [PATCH] md: md2: fix an incorrect NULL check on list iterator
Date: Mon, 28 Mar 2022 15:56:28 +0800 [thread overview]
Message-ID: <20220328075628.25545-1-xiam0nd.tong@gmail.com> (raw)
In-Reply-To: <bdc2ed02-6f13-c8a5-7e61-190a5dd9b6bc@linux.dev>
> 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
prev parent reply other threads:[~2022-03-28 7:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-27 8:01 [PATCH] md: md2: fix an incorrect NULL check on list iterator Xiaomeng Tong
2022-03-28 2:57 ` Guoqing Jiang
2022-03-28 7:56 ` Xiaomeng Tong [this message]
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=20220328075628.25545-1-xiam0nd.tong@gmail.com \
--to=xiam0nd.tong@gmail.com \
--cc=guoqing.jiang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=rgoldwyn@suse.com \
--cc=song@kernel.org \
--cc=stable@vger.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;
as well as URLs for NNTP newsgroup(s).